Use the CALLPRC command

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 procedure name may not be a variable. The PARM parameter is discussed under Passing Parameters between Programs and Procedures. 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:


The sequence of CALLPRC commands in a set of procedures calling each other is the call stack example.

In this series, the call stack is:


Call stack example.

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.

Related tasks
Pass parameters
Related information
Call Bound Procedure (CALLPRC) command