Comparing Index-Names and Index Data Items
Comparisons involving index-names and/or index data items conform to the
following rules:
- The comparison of two index-names is a comparison of the corresponding occurrence numbers.
- In the comparison of an index-name with a data item (other than an index data item), or in the comparison of an index-name with a literal, the occurrence number of the index-name is compared with the data item or literal.
- IBM ExtensionIBM Extension In the comparison of an index-name with an arithmetic expression, the occurrence number that corresponds to the value of the index-name is compared with the arithmetic expression.
Since an integer function may be used wherever an arithmetic expression may be used, this extension allows you to compare an index-name to an integer or numeric function.
End of IBM ExtensionEnd of IBM Extension - In the comparison of an index data item with an index-name or another index data item, the actual values are compared without conversion. Results of any other comparison involving an index data item are undefined.
Table 1 shows valid comparisons involving index-names and index data items.
| Operands Compared | Index-Name | Index Data Item | Data-Name | Literal | Arithmetic Expression |
|---|---|---|---|---|---|
| Index-Name | Compare occurrence number | Compare without conversion | Compare occurrence number with data-name | Compare occurrence number with literal | Compare occurrence number with arithmetic expression |
| Index Data Item | Compare without conversion | Compare without conversion | Not permitted | Not permitted | Not permitted |