Title: | VAX/DEC COBOL |
Notice: | Kit,doc,performance talk info-->DIR/KEY=KIT or DOC or PERF_TALK |
Moderator: | PACKED::BRAFFITT |
Created: | Mon Feb 03 1986 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3250 |
Total number of notes: | 13077 |
Hi, I have this customer who has this VAX Cobol problem. And beeing not knowledgable in Cobol I need help. Imagine these declarations where A_STRUC is copied from the CDD with a REPLACING-sentence to change the name at the 01-level. 01 A_STRUC. 02 A_SUB_STRUC. 03 SUB_STRUC OCCURS 9. 04 FIELD_1 PIC X. 04 ANOTHER_STRUC OCCURS 9. 05 FIELD_2 PIC X. 01 B_STRUC. 02 A_SUB_STRUC. 03 SUB_STRUC OCCURS 9. 04 FIELD_1 PIC X. 04 ANOTHER_STRUC OCCURS 9. 05 FIELD_2 PIC X. 01 IND_1 PIC S9(4) COMP. 01 IND_2 PIC S9(4) COMP. The problem is, how is one able to 'reach' the field, FIELD_2 in ANOTHER_STRUC(IND_2) in SUB_STRUC(IND_1) in A_SUBSTRUC in B_STRUC ? How should one write the indexing so the compiler fetches the right field ? I would like to write something like: FIELD_2 in ANOTHER_STRUC(IND_2) in SUB_STRUC(IND_1) in A_SUBSTRUC in B_STRUC but the compiler does not like it. It complaines either about "ambigous reference" or "too few subscripts". How should this be written ? Please advice. regards Johan
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
3233.1 | Suggest contacting our Product Manager | PACKED::MASLANKA | Wed Apr 23 1997 12:04 | 22 | |
Re .0 Your user has come upon a non-existant functionality of both VAX COBOL and DEC COBOL. The concurrent use of name qualification and subscripting/indexing of array members is not documented either in the Digital COBOL documentation sets or in the 1985 ANSI COBOL standard. A strict constructionist interpretation would say that this functionality does not have to be provided. In fact our COBOL products flag this syntax with diagnostic messages. In order to expedite the development of his application, it is suggested that your user should find an alternate method of programming for these data structures. If it is desired to add this functionality to the DEC/VAX COBOL products, please contact our Product Manager, who is Tarik TEAMLK::Nazeer, with a proposal. This is a difficult topic, and the investigation, design and coding which are required for it will be large. John Maslanka | |||||
3233.2 | the way I read the question... | WENDYL::BLATT | Wed Apr 23 1997 12:44 | 16 | |
Sorry John, I didn't see it that way. This should do the trick: FIELD_2 OF B_STRUC(IND_1, IND_2). You can or cannot include intervening group items. Cobol does not require that intervening groups be named (unless it is necessary to disambiguate them). FIELD_2 OF ANOTHER_STRUC OF SUB_STRUC OF A_SUB_STRUC OF B_STRUC (IND_1, IND_2) In any case, the subscripts always come last. | |||||
3233.3 | Wendy's right. I tried a test case with her syntax. | PACKED::MASLANKA | Wed Apr 23 1997 16:57 | 3 | |
Re .2 Don't be. | |||||
3233.4 | Thanks a lot for your fast & accurate help. | SWETSC::EKLUND | On a clear day you can see forever | Thu Apr 24 1997 12:03 | 1 |