ILE COBOL Language Reference
The Format 1 SEARCH statement executes a serial search beginning at the
current index setting. When the search begins, if the value of the
index-name associated with identifier-1 is not greater than the highest
possible occurrence number, the following actions take place:
- The condition(s) in the WHEN phrase are evaluated in the order in which
they are written.
- If none of the conditions is satisfied, the index-name for identifier-1 is
increased to correspond to the next table element, and step 1 is
repeated.
- If upon evaluation, one of the WHEN conditions is satisfied, the search is
terminated immediately, and the imperative-statement associated with that
condition is executed. The index-name points to the table element that
satisfied the condition. If NEXT SENTENCE is specified,
control passes to the statement following the closest period.
- If the end of the table is reached (that is, the incremented index-name
value is greater than the highest possible occurrence number) without the WHEN
condition being satisfied, the search is terminated, as described in the next
paragraph.
If, when the search begins, the value of the index-name associated with
identifier-1 is greater than the highest possible occurrence number, the
search immediately ends, and, if specified, the AT END imperative-statement is
executed. If the AT END phrase is omitted, control passes to the next
statement after the SEARCH statement.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.