Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

6.2.32.8 WHEN Phrase (Binary Search)



If the WHEN relation-condition is specified, the compare is based on the length and sign of data-name. For example, if the length of data-name is shorter than the length of the search argument, the search argument is truncated to the length of data-name before the compare is done. If the search argument is signed and data-name is unsigned, the sign is removed from the search argument before the compare is done.

If the WHEN phrase cannot be satisfied for any setting of the index within this range, the search is unsuccessful. Control is passed to imperative-statement-1 of the AT END phrase, when specified, or to the next statement after the SEARCH statement. In either case, the final setting of the index is not predictable.

If the WHEN option can be satisfied, control passes to imperative-statement-2, if specified, or to the next executable sentence if the NEXT SENTENCE phrase is specified. 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 subscripted by the first identifier-1 index-name. Each data-name can be qualified.

Data-name-1 and data-name-2 cannot be:

  • X Floating-point data items
    
    
  • Group items containing variable occurrence data items
    
    
  • X Windowed date fields
    
    

identifier-3
identifier-4
Must not be an ASCENDING/DESCENDING KEY data item for identifier-1 or an item that is subscripted by the first index-name for identifier-1.


X Identifier-3 and identifier-4 can be floating-point data items.


X Identifier-3 and identifier-4 cannot be data items defined with USAGE
X IS POINTER, USAGE IS PROCEDURE-POINTER, or USAGE IS OBJECT REFERENCE.


X Identifier-3 and identifier-4 cannot be windowed date fields.

arithmetic-expression
Can be any of the expressions defined under "Arithmetic Expressions" in topic 6.1.5, 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 subscripted 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.

Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.