IBM SC34-5764-01 Server User Manual


 
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
2. The result is one line of output for each of the inner loops.
Outer 1 Inner 1
Outer 2 Inner 1
Outer 3 Inner 1
Using Interrupt Instructions
Instructions that interrupt the flow of a program can cause the program to:
v End (EXIT)
v Skip to another part of the program marked by a label (SIGNAL)
v Go temporarily to a subroutine either within the program or outside the program (CALL or RETURN).
EXIT Instruction
The EXIT instruction causes a REXX program to unconditionally end and return to where the program was
called. If another program called the REXX program, EXIT returns to that calling program. More about
calling external routines appears later in this chapter and in Chapter 6, “Writing Subroutines and
Functions,” on page 57. For more detailed information on the EXIT instruction, see section “EXIT” on page
143.
Besides ending a program, EXIT can also return a value to the caller of the program. If the program was
called as a subroutine from another REXX program, the value is received in the REXX special variable
RESULT. If the program was called as a function, the value is received in the original expression at the
point where the function was called. Otherwise, the value is received in the REXX special variable RC.
The value can represent a return code and can be in the form of a constant or an expression that is
computed.
/******************************** REXX ****************************/
/* This program uses the EXIT instruction to end the program and */
/* return a value indicating whether a job applicant gets the */
/* job. A value of 0 means the applicant does not qualify for */
/* the job, but a value of 1 means the applicant gets the job. */
/* The value is placed in the REXX special variable RESULT. */
/******************************************************************/
PULL months_experience /* Gets number from input stream */
PULL references /* Gets "Y" or "N" from input stream */
PULL start_tomorrow /* Gets "Y" or "N" from input stream */
IF (months_experience > 24) & (references = 'Y') & (start_tomorrow= 'Y')
THEN job = 1 /* person gets the job */
ELSE job = 0 /* person does not get the job */
EXIT job
Figure 26. Example Using the EXIT Instruction
Control Flow within a Program
48
CICS TS for VSE/ESA: REXX Guide