COBOL Array/Table IndexCOBOL Table Subscript Diffences between index and subscript
Number of displacement positions of an array known as Index.
Take the above memory representation Diagram to understand better about index.
01 BTECH-1ST-YEAR. 02 STUDENT. 03 SUBJECT-MARKS PIC 9(03) OCCURES 6 TIMES.
Index need not be declared as a working-storage section item and it can be declared by using INDEX BY clause.
Index will be initialized by SET operator.
Subscript always starts from 1 and increase one by one to refer the next occurrence of element.
Here, Incrementing Index by 1 increment the total length of the single occurrence of array element.
The element can be referred like below in programming construction.
COBOL Table Subscript Diffences between index and subscript