Using Conditional Instructions
Exercise - Using the IF/THEN/ELSE Instruction
Write the REXX instructions for the following flowchart:
IF
False
B=2
False
A=3
ANSWER
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:
44
z/OS V1R1.0 TSO/E REXX User's Guide
False
True
IF
True
C=3
A=1
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
IF
True
A=0
IF
False
C=2
True
B=1