Can you pass an Index to another COBOL Program – via the LINKAGE SECTION?
No. Since INDEX is not a working storage area, an Index is maintained by the System. Indexes you cannot pass to another program. Subscripts you can pass. Because a subscript has a working storage definition. You can pass a Subscript to another COBOL Program.

Table of contents
COBOL 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).
The index value is set to ‘1’. The value you can increment or decrement using ‘UP’ or ‘DOWN” statements and PERFORM statements. Here is helpful example.
The Code is Explained
>>> He displayed A-TABLE-LIST data, and it populates as ‘XYZ—————————‘
>>> The first field is FILLER, so all are spaces even if you define value.
>>> Second field, when you issue ‘MOVE’. The first 3 bytes occupy XYZ and the rest of all spaces
>>> The third field is FILLER, so all are spaces, even if you define value.
Related Posts







One response
[…] want to share very important points on COBOL index. First point is Index cannot passed into SUB-PROGRAM and why. Second, is Index is not an […]
LikeLike