Exercise - Using the IF/THEN/ELSE Instruction
Write the REXX instructions for the following flowchart:
ANSWER
Possible Solution
IF A = 0 THEN
IF C = 2 THEN
B=1
ELSE NOP
ELSE
IF B = 2 THEN
IF C = 3 THEN
A=1
ELSE
A=3
ELSE NOP
SELECT/WHEN/OTHERWISE/END Instruction
To select one of any number of choices, use the
SELECT/WHEN/OTHERWISE/END instruction. In a flowchart it appears as follows:
False
False
False
True
True
True
IF
A=0
A=3
B=2
C=3
A=1
C=2
False
True
B=1
IF
IF
IF
Using Conditional Instructions
44
z/OS V1R1.0 TSO/E REXX User’s Guide