The Call Bound Procedure (CALLPRC) command calls a procedure named on the command, and passes control to it.
The Call Bound Procedure (CALLPRC) command has the following format:
CALLPRC PRC(procedure-name) PARM(parameter-values) RTNVAL(return-value-variable)
The procedure name may not be a variable. When the called procedure finishes running, control returns to the next command in the calling procedure.
The sequence of CALLPRC commands in a set of procedures calling each other is the call stack. For example, look at this series:
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 (RETURN) or an End Program (ENDPGM) command.
A CL procedure can call itself.