Using Conditional Instructions; If/Then/Else Instructions - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

Controlling the Flow Within an Exec
v Interrupt instructions, which tell the language processor to leave the exec entirely

Using Conditional Instructions

There are two types of conditional instructions. IF/THEN/ELSE can direct the
execution of an exec to one of two choices. SELECT/WHEN/OTHERWISE/END can
direct the execution to one of many choices.

IF/THEN/ELSE Instructions

The examples of IF/THEN/ELSE instructions in previous chapters demonstrated the
two-choice selection. In a flow chart, this appears as follows:
ELSE
As a REXX instruction, the flowchart example looks like:
IF expression THEN instruction
You can also arrange the clauses in one of the following ways to enhance
readability:
IF expression THEN
ELSE
or
IF expression
When you put the entire instruction on one line, you must separate the THEN
clause from the ELSE clause with a semicolon.
IF expression THEN instruction; ELSE instruction
Generally, at least one instruction should follow the THEN and ELSE clauses. When
either clause has no instructions, it is good programming practice to include NOP
(no operation) next to the clause.
42
z/OS V1R1.0 TSO/E REXX User's Guide
or leave one part of the exec and go to another part, either permanently or
temporarily. The REXX interrupt instructions are:
EXIT
SIGNAL label
CALL label/RETURN
False
instruction
ELSE instruction
instruction
instruction
THEN
instruction
ELSE
instruction
IF
True
expression
THEN
instruction

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents