NET/MASTER Network Control Language (NCL) Programmer's Guide
Language Elements
NCL Summary
2–8 106160 Tandem Computers Incorporated
PROCEDURE and FUNCTION Core Statements
The PROCEDURE and FUNCTION core statements are used to structure blocks of
code within an NCL procedure.
PROCEDURE explicitly declares a procedure. NCL procedures perform a task but do
not have to return a result to the calling procedure or function. They can return a
return code, which is placed in the system variable &SYS.RETCODE. They can also
return variables to the calling procedure or function.
There are two types of functions: built-in functions (described in more detail later in
this section) and user-written functions. The FUNCTION statement declares a user-
written function. All functions perform a task and return a result to the calling
procedure or function. Functions are called from expressions. The result of a function
is used as part of expression evaluation.
RETURN, EXIT, and END Core Statements
The RETURN core statement transfers control from a procedure or function back to the
calling procedure or function. RETURN is optional in a procedure. When used, it can
pass back a list of variables. RETURN is mandatory in a function. It is used to pass
back the result of the function to the expression.
The EXIT core statement is optional in a procedure. When used, EXIT transfers control
back to the calling procedure or function; it can also return a return code in the system
variable &SYS.RETCODE. EXIT cannot be used in a function.
The END core statement is mandatory in a procedure and function. It is used to
terminate the procedure or function declaration. In a procedure, it can also return
control to the calling procedure or function.
CALL Core Statement
The CALL core statement invokes another NCL procedure for execution from within
an NCL procedure or a user-written function. Unlike the EXEC and START
commands and the START verb, CALL does not create an NCL process, with an NCL
process identifier.
GOTO, GOSUB, SIGNAL LABEL, and RETSUB Core Statements
The GOTO and GOSUB core statements and the SIGNAL core statement with the
LABEL keyword transfer execution control to a specified label. GOTO transfers
control unconditionally. GOSUB transfers control to a subroutine. SIGNAL LABEL
transfers control to a label and removes all previous GOSUB nesting.
The RETSUB core statement transfers control from a subroutine to the statement
following the GOSUB statement that invoked it.