Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

Procedure activation

Sequential program flow passes around a procedure, from the statement before the PROCEDURE statement to the statement after the END statement for that procedure. The only way that a procedure can be activated is by a procedure reference. (Program activation tells how to activate the main procedure.) The execution of the invoking procedure is suspended until the invoked procedure returns control to it.

A procedure reference is the appearance of an entry expression in one of the following contexts:

The information in this section is relevant to each of these contexts. However, the examples in this chapter use CALL statements.

When a procedure reference occurs, the procedure containing the specified entry point is said to be invoked. The point at which the procedure reference appears is called the point of invocation and the block in which the reference is made is called the invoking block. An invoking block remains active even though control is transferred from it to the procedure it invokes.

When a procedure is invoked at its primary entry point, arguments and parameters are associated and execution begins with the first statement in the invoked procedure. When a procedure is invoked at a secondary entry point with the ENTRY statement, execution begins with the first statement following the ENTRY statement. The environment established on entry to a block at the primary entry point is identical to the environment established when the same block is invoked at a secondary entry point.

Communication between two procedures is by means of arguments passed from an invoking procedure to the invoked procedure, by a value returned from an invoked procedure, and by names known within both procedures. Therefore, a procedure can operate upon different data when it is invoked from different points. For example,

Readin: procedure;
statement-1
statement-2
Errt: entry;
statement-3
statement-4
end Readin;

can be activated by any of these entry references:

  call Readin;
  call Errt;

The statement call Readin invokes Readin at its primary entry point and execution begins with statement-1; the statement call Errt invokes the Readin procedure at the secondary entry point Errt and execution begins with statement-3. The entry constant (Readin) can also be assigned to an entry variable that is used in a procedure reference. For example:

  declare Readin entry,
          Ent1 entry variable;
  Ent1 = Readin;
  call Ent1;
  call Readin;

The two CALL statements have the same effect.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)