EasyManuals Logo

IBM TSO/E REXX User Manual

IBM TSO/E REXX
242 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #75 background imageLoading...
Page #75 background image
v Go temporarily to a subroutine either within the exec or outside the exec
(CALL/RETURN).
EXIT Instruction
The EXIT instruction causes an exec to unconditionally end and return to where the
exec was invoked. If the exec was initiated from the PROC section of an ISPF
selection panel, EXIT returns to the ISPF panel. If the exec was called by a
program, such as another exec, EXIT returns to the program. More about calling
external routines appears later in this chapter and in Chapter 6. Writing
Subroutines and Functions on page 69.
In addition to ending an exec, EXIT can also return a value to the invoker of the
exec. If the exec was invoked as a subroutine from another REXX exec, the value
is received in the REXX special variable RESULT. If the exec was invoked as a
function, the value is received in the original expression at the point where the
function was invoked. 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.
Example Using the EXIT Instruction
/******************************** REXX *****************************/
/* This exec uses the EXIT instruction to end the exec and return */
/* a value that indicates whether or not 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. */
/*******************************************************************/
SAY 'How many months of experience do you have? Please enter'
SAY 'the months as a number.'
PULL month
SAY 'Can you supply 3 references? Please answer Y or N.'
PULL reference
SAY 'Are you available to start work tomorrow? Please answer Y or N.'
PULL tomorrow
IF (month > 24) & (reference = 'Y') & (tomorrow = 'Y') THEN
job = 1 /* person gets the job */
ELSE
job = 0 /* person does not get the job */
EXIT job
CALL/RETURN Instructions
The CALL instruction interrupts the flow of an exec by passing control to an internal
or external subroutine. An internal subroutine is part of the calling exec. An external
subroutine is another exec. The RETURN instruction returns control from a
subroutine back to the calling exec and optionally returns a value.
When calling an internal subroutine, CALL passes control to a label specified after
the CALL keyword. When the subroutine ends with the RETURN instruction, the
instructions following CALL are executed.
Using Interrupt Instructions
Chapter 4. Controlling the Flow Within an Exec 57

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM TSO/E REXX and is the answer not in the manual?

IBM TSO/E REXX Specifications

General IconGeneral
BrandIBM
ModelTSO/E REXX
CategoryComputer Hardware
LanguageEnglish

Related product manuals