CALL

Purpose

Transfers control to an entry point of a procedure and optionally passes arguments to the procedure.

Syntax

CALL reference[([argument][,argument]…)];

Parameters

reference
Identifies an entry name, entry variable, or entry-valued function.
argument
An expression

Description

The CALL statement transfers control to an entry point of a procedure and optionally passes arguments to the procedure.

Execution of a CALL statement activates the procedure block identified by a reference, which can be an entry name, entry variable, or entry-valued function. The procedure designated by that entry value is called and passed any arguments given with the reference. The procedure thus activated must not have a RETURNS option and must have the same number of parameters as the reference has arguments, unless the declaration of the ENTRY name includes the OPTIONS(VARIABLE) attribute. A procedure with no argument can be called using a reference with an empty argument list () or no argument list. If the procedure is called with an argument list, each argument in that list is evaluated and, if necessary, converted to the data type of the corresponding parameter. For a discussion of argument passing and parameters, see the section Parameter Storage Class in the chapter Storage Classes.

The order in which arguments and other components of the reference in a CALL statement are evaluated is unspecified.

Example

DECLARE E ENTRY (FIXED BINARY, FIXED BINARY, FLOAT BIN); 
DECLARE F ENTRY;
DECLARE G ENTRY; 
CALL E(A,B,5+X); 
CALL F;
CALL G();

Restrictions

On 64-bit platforms, the Open PL/I CALL and DECLARE statements do not support defining or calling functions which accept a variable, unknown number of parameters.