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

Functions

Examples
Built-in functions

A function is a procedure that has zero or more arguments and is invoked by a function reference in an expression. The function reference transfers control to a function procedure; the function procedure returns control and a value, which replaces the function reference in the evaluation of the expression. Aggregates cannot be returned; ENTRY variables cannot be returned unless they have the LIMITED attribute. The evaluation of the expression then continues.

A function procedure must:

Whenever a function is invoked, the arguments in the invoking expression are associated with the parameters of the entry point. Control is then passed to that entry point. The function is activated and execution begins.

The RETURN statement terminates a function and returns the value specified in its expression to the invoking expression. See RETURN statement for more information.

A function can be abnormally terminated as described in Procedure termination. If this method is used, evaluation of the expression that invoked the function is not completed, and control goes to the designated statement.

In some instances, a function can be defined so that it does not require an argument list. In such cases, the appearance of an external function name within an expression is recognized as a function reference only if the function name has been explicitly declared as an entry name. See Entry invocation or entry value for additional information.


Terms of use | Feedback

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