IBM SC34-5764-01 Server User Manual


 
instruction(s)
EXIT
instruction(s)
instruction(s)
RETURN
z=func1(arg1, arg2)
Both subroutines and functions can be internal (designated by a label) or external (designated by the
subroutine or function in the REXX File System/VSE Librarian sublibrary member name). The two
preceding examples illustrate an internal subroutine named sub1 and an internal function named func1.
IMPORTANT NOTE
Because internal subroutines and functions generally appear after the main part of the program,
when you have an internal subroutine or function, it is important to end the main part of the program
with the EXIT instruction.
The following illustrates an external subroutine named sub2.
instruction(s)
...
sub2:
instruction(s)
RETURN
instruction(s)
CALL sub2
MAIN
The following illustrates an external function named func2.
Writing Subroutines and Functions
Chapter 6. Writing Subroutines and Functions 59