NET/MASTER Network Control Language (NCL) Programmer's Guide
6 Procedures and Functions
106160 Tandem Computers Incorporated 6–1
This section discusses NCL procedures and functions. The section:
Introduces the different types of NCL procedures and functions
Explains how to declare procedures and user-written functions
Explains how to terminate execution of the current procedure or function
Discusses how to pass parameters to procedures and functions
Discusses how to share variables to procedures and functions
Describes how to call procedures and functions
Table 6-1 summarizes the core statements discussed in this section.
Table 6-1. Core Statements Used With NCL Procedures and Functions
Core Statement Description
CALL Calls an NCL procedure.
END Terminates an NCL procedure or function declaration, or ends a SELECT group or
DO group.
EXIT Returns from the current NCL procedure to the calling NCL procedure.
FUNCTION Declares a user-written function.
PROCEDURE Declares an NCL procedure.
RETURN Terminates execution of an NCL procedure or function.
For the complete syntax of core statements, refer to the NonStop NET/MASTER NCL
Reference Manual.
Introducing NCL
Procedures and
Functions
An NCL procedure is a sequence of NCL statements that performs a task and,
optionally, returns a result when it terminates. A procedure can return variables or a
return code when it terminates. The return code is placed in the system variable
&SYS.RETCODE. The return code indicates the successful or unsuccessful completion
of the task performed by the procedure. (For information on system variables, refer to
the NonStop NET/MASTER NCL Reference Manual.)
A function, in contrast to a procedure, performs a task and returns a single result.
Functions can be called only from within an expression. The result returned by a
function is normally used by NCL as it evaluates the expression. (For information on
expressions, refer to the NonStop NET/MASTER NCL Reference Manual.)
NCL supports two types of procedures, and three types of functions:
Built-in functions
External procedures and external, user-written functions
Internal procedures and internal, user-written functions