COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

indexer cannot specify a special register. indexer cannot be subscripted by the first (or
the only) index-name specified in the INDEXED phrase of the OCCURS clause of the definition
of table.
When indexer is from the INDEXED phrase, that index is used to start the search. When it
is a separate item, index-1 from the INDEXED option is used to search table, and indexer
is incremented by 1 when index-1 is incremented.
The SEARCH statement does not initialize its index (either indexer or index-1). The value
of the index at the time the search begins is used.
imperative-stmt-1
is an imperative statement to be executed when an at-end condition is detected during the
search.
condition
specifies a conditional expression used to control the search for an element.
imperative-stmt-2
is an imperative statement to be executed when a condition is satisfied.
NEXT SENTENCE
specifies that control be passed directly to the end of the SEARCH statement. It is not
recommended (see Usage Considerations).
END-SEARCH
ends the scope of the SEARCH statement, causing the SEARCH to be a delimited-scope statement.
Without the END-SEARCH phrase, the SEARCH statement is a conditional statement, which
ends at the next period separator.
Usage Considerations:
CONTINUE is Recommended Over NEXT SENTENCE
NEXT SENTENCE transfers control to the next period (.), while CONTINUE transfers control
to END-SEARCH. Either imperative-stmt-1, imperative-stmt-2, or both can be
CONTINUE statements.
Execution
The SEARCH VARYING statement specifies a serial search through elements of the table
referenced by table. In general terms, the search operation successively increments the value
of an index-name, which represents the occurrence number of an element in the table, until
either some condition evaluates to TRUE or the occurrence number represented by the value
of the index-name exceeds the maximum defined for the table.
When the VARYING phrase is present, and if it specifies an index-name associated with
table (by its OCCURS clause), then that index-name is used for the search. If it specifies an
index-name not associated with table, or if it specifies a separate integer data item or an
index data item, the primary index of table is used in the search (starting at its current
setting), and these operations occur:
If you specify an index-name associated with another table, the process increments the
occurrence number that index-name represents by the same amount and at the same time
as it increments the occurrence number the primary index represents.
If you specify an index data item, the process increments the value of the item by the
same amount and at the same time as it increments the index associated with table.
If you specify an integer data item, the process increments the value of the item by 1 at
the same time as it increments the index associated with table.
Without the VARYING phrase, the search varies the value of the primary index of table
(starting at its current setting). Any other indexes specified with table remain unchanged.
SEARCH 429