The CALL command calls a program named on the command, and passes control to it. The CALL command has the following format:
CALL PGM(library-name/program-name) PARM(parameter-values)
The program name or library name may be a variable. If the called
program is in a library that is not on the library list, you must specify the
qualified name of the program on the PGM parameter. The PARM parameter
is discussed under Passing Parameters between Programs and Procedures. When the called program finishes running, control
returns to the next command in the calling program.
The sequence of CALL commands in a set of programs calling each other is
the call stack. For example, in this series:
the call stack is:
When PROGC finishes processing, control returns to PROGB at the command after the call to PROGC. Control is thus returned up the call stack. This occurs whether or not PROGC ends with a RETURN or an ENDPGM command.
A CL program can call itself.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.