IBM TSO/E REXX User Manual page 89

Table of Contents

Advertisement

instruction(s)
CALL sub1
instruction(s)
EXIT
sub1:
instruction(s)
RETURN
Subroutines may be internal and designated by a label, or external and designated
by the data set member name that contains the subroutine. The preceding example
illustrates an internal subroutine named "sub1".
IMPORTANT NOTE
Because internal subroutines generally appear after the main part of the exec,
when you have an internal subroutine, it is important to end the main part of
the exec with the EXIT instruction.
The following illustrates an external subroutine named "sub2".
To determine whether to make a subroutine internal or external, you might consider
REXX.EXEC(MAIN)
instruction(s)
CALL sub2
instruction(s)
.
.
.
REXX.EXEC(SUB2)
instruction(s)
RETURN
factors, such as:
v Size of the subroutine. Very large subroutines often are external, whereas small
subroutines fit easily within the calling exec.
v How you want to pass information. It is quicker to pass information through
variables in an internal subroutine. This method is described in "Passing
Information by Using Variables" on page 72.
v Whether the subroutine might be of value to more than one exec or user. If so,
an external subroutine is preferable.
Writing a Subroutine;
Chapter 6. Writing Subroutines and Functions
71

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents