NET/MASTER Network Control Language (NCL) Reference Manual

FUNCTION
Core Statements
106126 Tandem Computers Incorporated 2–23
The following example shows a procedure that contains a function definition. This
procedure displays five pairs of literal strings, typed in by the user at an OCS window
or supplied from another calling procedure. The ASSIGN verb uses the VARS
operand to invoke the GETIT function, to return the pairs of strings. It also
demonstrates the use of a DO loop within a function definition:
FUNCT: PROCEDURE
ASSIGN VARS=((GETIT())) FROM ARGS
NAMEIT:
DO &J=1 TO 5
SAY &NAME&J "AND" &VALUE&J
END NAMEIT
GETIT: FUNCTION
DOIT:
DO &I=1 TO 10
&RESULT=&RESULT ""NAME"&I" ""VALUE"&I"
END DOIT
RETURN (&RESULT)
END GETIT
END FUNCT
See the ASSIGN verb in Section 3, “Verbs,” for a full explanation of the options
available for assigning values to, and creating, variables.