WHEN Phrase
If the WHEN phrase cannot be satisfied for any setting of the index within this range, the search is unsuccessful.
If the WHEN option can be satisfied, control passes
to imperative-statement-2, and the index contains the value indicating the
occurrence that allowed the WHEN condition(s) to be satisfied.
- condition-name-1, condition-name-2
- Each condition-name specified must have only a single value, and each must be associated with an ASCENDING/DESCENDING KEY identifier for this table element.
- data-name-1, data-name-2
- Must specify an ASCENDING/DESCENDING KEY data item in the identifier-1
table element and must be indexed by the first identifier-1 index-name, along
with other indexes or literals, as required. Each data-name may be qualified.
IBM Extension
IBM Extension Data-name-1 or data-name-2 cannot be a floating-point data item. Data-name-1 or data-name-2 can be a date-time data item. End of IBM Extension
End of IBM Extension - identifier-3, identifier-4
- Must not be an ASCENDING/DESCENDING KEY data item for identifier-1 or
an item that is indexed by the first index-name for identifier-1.
Must not be a pointer or procedure-pointer data item.
IBM ExtensionIBM Extension Can be floating-point or date-time data items. End of IBM Extension
End of IBM Extension - arithmetic-expression-1, arithmetic-expression-2
- May be any of the expressions defined under Arithmetic Expressions, with
the following restriction: Any identifier in the arithmetic-expression must
not be an ASCENDING/DESCENDING KEY data item for identifier-1 or an item that
is indexed by the first index-name for identifier-1.
When an ASCENDING/DESCENDING KEY data item is specified, explicitly or implicitly, in the WHEN phrase, all preceding ASCENDING/DESCENDING KEY data-names for identifier-1 must also be specified.
The results of a SEARCH ALL operation are predictable only when:
- The data in the table is ordered according to the ASCENDING/DESCENDING KEY phrase
- The contents of the ASCENDING/DESCENDING keys specified in the WHEN clause provide a unique table reference.