COBOL: Indexed By Vs Subscript key Differences

You can refer my posts on INDEXED BY and KEY IS of a Table.

How a Subscript Works in COBOL

  • Subscript should be an integer.
  • It should have a working storage definition
  • Subscript can be passed to a sub-program
  • Subscript varies from 1 to size of OCCURS
  • Subscript references a Table item


How an Indexed By Works in COBOL

  1. An INDEXED BY XXXX phrase must be defined for an array/table
  2. An index cannot be passed to a sub-program
  3. It does not require working storage definition
  4. The index varies from 0 to size of (OCCURS-1)
  5. It references a Table item.
  6. It is an internal representation
  7. Performance-wise index is good compared to subscript

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.