INDEX phrase
A data item defined with the INDEX phrase is an index data item.
An index data item is a 4-byte elementary item or an 8-byte elementary item depending on whether the ADDR(32) or ADDR(64) compiler option is in effect, that can be used to save index-name values for future reference. An index data item is not necessarily connected with any specific table. Through a SET statement, an index data item can be assigned an index-name value. Such a value corresponds to the occurrence number in a table.
Direct references to an index data item can be made only in a SEARCH statement, a SET statement, a relation condition, the USING phrase of the PROCEDURE DIVISION header, or the USING phrase of the CALL or ENTRY statement.
An index data item can be part of an alphanumeric group item that is referenced in a MOVE statement or an input/output statement.
An index data item saves values that represent table occurrences, yet is not necessarily defined as part of any table. There is no conversion of values when an index data item is referenced in the following circumstances:
- directly in a SEARCH or SET statement
- indirectly in a MOVE statement
- indirectly in an input or output statement
An index data item cannot be a conditional variable.
The DATE FORMAT, JUSTIFIED, PICTURE, BLANK WHEN ZERO, VALUE, TYPE, or FORMAT clauses cannot be used to describe a group item or elementary items described with the USAGE IS INDEX clause.
SYNCHRONIZED can be used with USAGE IS INDEX to obtain efficient use of the index data item.