Can you pass an Index to another COBOL Program, via LINKAGE SECTION?
No. Since INDEX is not a Working-storage area, and Index is maintained by the System.
Indexes you cannot pass to other program. Subscripts you can pass. Because subscript has working storage definition.
You can pass a Subscript to another COBOL Program.
COBOL Array: Indexed By Best Example.
05 A-TABLE.
10 A-TABLE-LIST OCCURS 10 TIMES INDEXED BY A-IDX.
15 FILLER PIC X(7) VALUE '<TEST>'.
15 A-LIST-VALUE PIC X(30).
15 FILLER PIC X(8) VALUE '</TEST>'.
The next he did as below:
SET A-IDX to 1.
MOVE 'XYZ' to A-LIST-VALUE(A-IDX).
>>> He displayed A-TABLE-LIST data and it populates as ‘XYZ—————————‘
>>> The first field is FILLER so all spaces even you define value.
>>> Second field, when you issue ‘MOVE’. First 3 bytes occupies XYZ and rest all spaces
>>> Third field is FILLER so all spaces even you define value.
Related Posts
One thought
Comments are closed.