NET/MASTER Network Control Language (NCL) Programmer's Guide

Terminating Execution of the Current Procedure or Function
Procedures and Functions
6–16 106160 Tandem Computers Incorporated
The following screen shows the results of executing the procedure:
(09:13) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0608N
Top level
It is a SUNNY day today
First level
Top level
It is a RAINY day today so I need an umbrella
NNM1005 START ZEX0608N PROCESSING COMPLETE. NCLID 001010
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>
Sharing variables is discussed in more detail later in this section.
Using the RETURN Statement in Functions
Using the RETURN core statement in a function is mandatory. You must use
RETURN to return the result of the function to the calling procedure or function. The
result must be an expression that evaluates to a single value. You must enclose the
result in parentheses (( )). NCL uses the result to evaluate the expression that called
the function. The result of a function effectively replaces the expression that called the
function.
The following example shows the RETURN statement in a function:
zex0609n: PROCEDURE
/* Using RETURN in a user-written function */
SAY "First parameter is "&1
SAY "Second parameter is "&2
SAY "The Nth root of "&1" where N="&2" is "rootn(&1,&2)
rootn: FUNCTION
/* Check validity of arguments */
IF TYPECHK(NUM,&1,&2) \= NUM THEN
RETURN("using invalid arguments")
ELSE
RETURN(&1**(1/&2))
END rootn
END zex0609n
The top-level NCL procedure assumes that you enter two parameters when you
execute it. The first parameter is placed in the variable &1; the second parameter is