z/OS TSO/E CLISTs
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Compound SELECT

z/OS TSO/E CLISTs
SA32-0978-00

A compound SELECT statement includes an initial test expression. The CLIST evaluates the test expression and compares its value to those of the WHEN expressions.

In a compound SELECT statement, a WHEN expression can contain multiple expressions separated by the logical operator | (OR). WHEN expressions can also include ranges of values, represented by a colon (:) between the lowest and highest values of the range. For example, 3:5 represents 3, 4, and 5.

When a test expression matches a value or falls within a range of values in a WHEN expression, the CLIST performs the associated action and passes control to the END statement. If no matches are found, the CLIST performs the action on the OTHERWISE clause, if any, or passes control to the END statement.

Read syntax diagramSkip visual syntax diagram
>>-+--------+--SELECT--test_expression-------------------------->
   '-label:-'                            

   .-----------------------------------------------------------.   
   V                                                           |   
>----WHEN--(--expression--+-------------------+--)--+--------+-+-->
                          '-+-:--+-expression-'     '-action-'     
                            +-|--+                                 
                            '-OR-'                                 

>--+-------------------+--+--------+--END----------------------><
   '-OTHERWISE--action-'  '-label:-'        

label
A name the CLIST can reference in a GOTO statement to branch to this SELECT statement. label is one-to-31 alphanumeric characters, beginning with an alphabetic character.
test_expression
A character string or a logical expression that results in a value to be compared to the expressions in the WHEN clauses.
expression
A character string, a single logical expression, or a range such as 1:5. Values and ranges can be combined, for example: WHEN (&A-3 | &B | 4:6)
action
Any CLIST statement, TSO/E command, or DO sequence. A null action passes control to the END statement. The action can include nested IF, DO, and SELECT statements. Any statements in the action can have labels of their own.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014