Call Operations

The call operations are shown in the following table.

Table 62. Call Operations
Operation Traditional Syntax Free-Form Syntax
Call Program or Procedure CALLP (Call a Prototyped Procedure or Program)
Identify Parameters PI or PR definition specification
Number of Parameters %PARMS (Return Number of Parameters)
Number of a Parameter %PARMNUM (Return Parameter Number)
Return RETURN (Return to Caller)

CALLP is one type of prototyped call. The second type is a call from within an expression. A prototyped call is a call for which there is a prototype defined for the call interface. The prototype may be explicitly defined using a Prototype definition, or it may be implicitly defined by the compiler from the Procedure Interface, if the procedure is defined in the same module as the call.

Call operations allow an RPG IV procedure to transfer control to other programs or procedures. However, prototyped calls differ from the CALL and CALLB operations in that they allow free-form syntax.

The RETURN operation transfers control back to the calling program or procedure and returns a value, if any. The PLIST and PARM operations can be used with the CALL and CALLB operations to indicate which parameters should be passed on the call. With a prototyped call, you pass the parameters on the call.

The recommended way to call a program or procedure (written in any language) is to code a prototyped call.



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