SEARCH Statement - Format 2 - Binary Search >>-SEARCH ALL--identifier-1-------------------------------------> >--+-------------------------------------+----------------------> '-+----+--END--imperative-statement-1-' '-AT-' >--WHEN--+-| equal phrase 1 |-+---------------------------------> '-condition-name-1---' .---------------------------------. V | >----+-----------------------------+-+--------------------------> '-AND--+-| equal phrase 2 |-+-' '-condition-name-2---' >--+-imperative-statement-2-+--+------------+------------------>< '-+---------------+------' '-END-SEARCH-' '-NEXT SENTENCE-' equal phrase 1 |--data-name-1--+----+--+-EQUAL--+----+-+-----------------------> '-IS-' | '-TO-' | '-=-------------' >--+-identifier-3------------+----------------------------------| +-literal-1---------------+ '-arithmetic-expression-1-' equal phrase 2 |--data-name-2--+----+--+-EQUAL--+----+-+-----------------------> '-IS-' | '-TO-' | '-=-------------' >--+-identifier-4------------+----------------------------------| +-literal-2---------------+ '-arithmetic-expression-2-'
Identifier-1 can specify a table containing floating-point data items, a table containing DBCS items, or a table containing date-time items.
Identifier-1 must refer to all occurrences within the table element; that is, it must not be subscripted or reference modified.
The Data Division description of identifier-1 must contain an OCCURS clause with the INDEXED BY phrase.
SEARCH statement execution modifies only the value in the index-name associated with identifier-1 and, if present, of index-name-1 or identifier-2 (see VARYING Phrase). Therefore, to search an entire two- to seven-dimensional table, it is necessary to execute a SEARCH statement for each dimension. Before each execution, SET statements must be executed to reinitialize the associated index-names.