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

Procedures

PROCEDURE and ENTRY statements
ENTRY statement
Parameter attribute
Procedure activation
Procedure termination
Recursive procedures
Dynamic loading of an external procedure

A procedure is a sequence of statements delimited by a PROCEDURE statement and a corresponding END statement. A procedure can be a main procedure, a subroutine, or a function. An application must have exactly one external procedure that has OPTIONS(MAIN). In the following example, the name of the procedure is Name and represents the entry point of the procedure.

  Name:
     procedure;
  end Name;

The ENTRY statement can define a secondary entry point to a procedure. For example,

  Name: procedure;
  B: entry;
  end Name;

B defines a secondary entry point to the Name procedure. The ENTRY statement is described in ENTRY attribute.

A procedure must have a name. A procedure block nested within another procedure or begin-block is called an internal procedure. A procedure block not nested within another procedure or begin-block is called an external procedure. Level-1 exported procedures from a package also become external procedures. External procedures can be invoked by other procedures in other compilation units. Procedures can invoke other procedures.

A procedure can be recursive, which means that it can be reactivated from within itself or from within another active procedure while it is already active. You can pass arguments when invoking a procedure.

For more information on these subjects, see the following sections:


Terms of use | Feedback

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