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


IF-THEN-ELSE sequence

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

Use the IF-THEN-ELSE sequence to define a condition, test the truth of that condition, and initiate an action based on the test results. Do not code THEN and ELSE on the same logical line.

Read syntax diagramSkip visual syntax diagram
>>-+--------+--IF--logical_expression--THEN--+--------+--------->
   '-label:-'                                '-action-'   

>--+-----------------+-----------------------------------------><
   '-ELSE-+--------+-'   
          '-action-'     

label
A name the CLIST can reference in a GOTO statement to branch to this IF-THEN-ELSE sequence. label is one-to-31 alphanumeric characters, beginning with an alphabetic character.
logical_expression
A comparative expression or a sequence of comparative expressions sequenced by logical operators. The expression or expressions can include character data, including characters of the double-byte character set.
action
An executable command, subcommand, or CLIST statements. (Enclose an action consisting of more than one statement in a DO-sequence.) The THEN action is invoked if the logical expression is true. The ELSE action is invoked if the logical expression is false. If a null THEN or null ELSE statement is executed, control passes to the next sequential statement after the IF-THEN-ELSE sequence.
The action must be on the same line as a THEN or ELSE clause, or be joined to the line by a continuation character. For example, the following are correct:
IF &FOOTPRINT = 0 THEN SET ECODE = 4

IF &FOOTPRINT = 0 THEN + 
  SET ECODE = 4

IF &FOOTPRINT = 0 THEN + 
  DO
    SET ECODE = 4
⋮
  END

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014