VARYING Phrase

index-name-1
One of the following actions applies:
  • If index-name-1 is an index for identifier-1, this index is used for the search. Otherwise, the first (or only) index-name is used.
  • If index-name-1 is an index for another table element, then the first (or only) index-name for identifier-1 is used for the search; the occurrence number represented by index-name-1 is increased by the same amount as the search index-name and at the same time.

When the VARYING index-name-1 phrase is omitted, the first (or only) index-name for identifier-1 is used for the search.

identifier-2
Must be either an index data item or an elementary integer item. During the search, one of the following actions applies:
  • If identifier-2 is an index data item, then, whenever the search index is increased, the specified index data item is simultaneously increased by the same amount.
  • If identifier-2 is an integer data item, then, whenever the search index is increased, the specified data item is simultaneously increased by 1.

Figure 1 illustrates a Format 1 SEARCH operation containing two WHEN phrases.

Figure 1. Format 1 SEARCH with Two WHEN Phrases
This figure illustrates a Format 1 SEARCH operation containing two WHEN phrases
*
These operations are included only when called for in the statement.
**
Control transfers to the next sentence, unless the imperative statement ends with a GO TO statement.