Search Statement Considerations

Index data items cannot be used as subscripts, because of the restrictions on direct reference to them.

The use of a direct indexing reference together with a relative indexing reference for the same index-name allows reference to two different occurrences of a table element for comparison purposes.

When the object of the VARYING option is an index-name for another table element, one Format 1 SEARCH statement steps through two table elements at once.

To ensure correct execution of a SEARCH statement for a variable-length table, make sure the object of the OCCURS DEPENDING ON clause (data-name-1) contains a value that specifies the current length of the table.

The scope of a SEARCH statement may be terminated by any of the following:
  • An END-SEARCH phrase at the same level of nesting
  • A separator period
  • An ELSE or END-IF phrase associated with a previous IF statement.