Module 9: Array processing and Table handling
Difference between Subscript and Index
Subscript | Index |
---|---|
Denotes position/occurrence of the element in an array | Denotes displacement of the element from beginning of an array |
Declared in WORKING-STORAGE SECTION separately | No need to declare in WORKING-STORAGE SECTION |
Occurrence is converted into displacement to access array element thus, slower. | Since it already denotes displacement, thus no conversion needed. This makes it faster and efficient |
It is valid to use subscript in arithmetic operation or for display | It is invalid to use INDEX in arithmetic operation or for display |
Subscript modification is possible with any arithmetic operation | INDEX modification is possible only with SET, SEARCH and PERFORM |