CL Programming


CALLPRC Command

The CALLPRC command calls a procedure named on the command, and passes control to it. The CALLPRC command has the following format:

CALLPRC Procedure(procedure-name) PARM(parameter-values) RTNVAL(return-value-variable)

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 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, in this series:
The sequence of CALLPRC commands in a set of procedures calling each other is the call stack example.

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 or an ENDPGM command.

A CL procedure can call itself.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]