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
Содержание TSO/E REXX
Страница 1: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Страница 2: ......
Страница 3: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Страница 10: ...viii z OS V1R1 0 TSO E REXX User s Guide ...
Страница 12: ...x z OS V1R1 0 TSO E REXX User s Guide ...
Страница 14: ...xii z OS V1R1 0 TSO E REXX User s Guide ...
Страница 18: ...xvi z OS V1R1 0 TSO E REXX User s Guide ...
Страница 20: ...2 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 58: ...Tracing Expressions with the TRACE Instruction 40 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 78: ...60 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 86: ...Built In Functions 68 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 128: ...Issuing Other Types of Commands from an Exec 110 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 136: ...Debugging Execs 118 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 170: ...Protecting Elements in the Data Stack 152 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 201: ...Part 3 Appendixes Copyright IBM Corp 1988 2001 183 ...
Страница 202: ...184 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 222: ...Using Variables 204 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 226: ...208 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 238: ...220 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 241: ......