Using Interrupt Instructions; Exercises - Combining Loops - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

Using Looping Instructions
END
The result is as follows:

Exercises - Combining Loops

1. What happens when the following exec runs?
2. Now what happens when the LEAVE instruction is added?
ANSWERS
1. When this example runs, you see on your screen the following:
2. The result is one line of output for each of the inner loops.

Using Interrupt Instructions

Instructions that interrupt the flow of an exec can cause the exec to:
v Terminate (EXIT)
v Skip to another part of the exec marked by a label (SIGNAL)
56
z/OS V1R1.0 TSO/E REXX User's Guide
ELSE
SAY 'HIP'
END
SAY 'HURRAH'
HIP
HURRAH
HIP
HURRAH
DO outer = 1 TO 3
SAY
DO inner = 1 TO 3
SAY 'Outer' outer 'Inner' inner
END
END
DO outer = 1 TO 3
SAY
DO inner = 1 TO 3
IF inner = 2 THEN
LEAVE inner
ELSE
SAY 'Outer' outer 'Inner' inner
END
END
Outer 1 Inner 1
Outer 1 Inner 2
Outer 1 Inner 3
Outer 2 Inner 1
Outer 2 Inner 2
Outer 2 Inner 3
Outer 3 Inner 1
Outer 3 Inner 2
Outer 3 Inner 3
Outer 1 Inner 1
Outer 2 Inner 1
Outer 3 Inner 1
/* Write a blank line
/* Write a blank line
*/
*/

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents