[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference clt::cobol

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

3233.0. "Advice please " by SWETSC::EKLUND (On a clear day you can see forever) Wed Apr 23 1997 12:46

	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.RTitleUserPersonal
Name
DateLines
3233.1Suggest contacting our Product Manager PACKED::MASLANKAWed Apr 23 1997 15:0422
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.2the way I read the question...WENDYL::BLATTWed Apr 23 1997 15:4416
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.3Wendy's right. I tried a test case with her syntax.PACKED::MASLANKAWed Apr 23 1997 19:573
Re .2

Don't be.
3233.4Thanks a lot for your fast & accurate help.SWETSC::EKLUNDOn a clear day you can see foreverThu Apr 24 1997 15:031