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

Declaring Procedures and User-Written Functions
Procedures and Functions
106160 Tandem Computers Incorporated 6–11
The following screen shows the results of executing the procedure six times:
(14:01) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0605N 4
The square root of 4 is 2
NNM1005 START ZEX0605N PROCESSING COMPLETE. NCLID 002041
START ZEX0605N 9
The square root of 9 is 3
NNM1005 START ZEX0605N PROCESSING COMPLETE. NCLID 002042
START ZEX0605N 16
The square root of 16 is 4
NNM1005 START ZEX0605N PROCESSING COMPLETE. NCLID 002043
START ZEX0605N 37
The square root of 37 is 6.08276253029822
NNM1005 START ZEX0605N PROCESSING COMPLETE. NCLID 002044
START ZEX0605N ABC
The square root of ABC is using invalid arguments
NNM1005 START ZEX0605N PROCESSING COMPLETE. NCLID 002045
START ZEX0605N -4
The square root of -4 is using invalid arguments
NNM1005 START ZEX0605N PROCESSING COMPLETE. NCLID 002046
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>
The values entered are 4, 9, 16, and 37 (correctly), and ABC and -4 (incorrectly).
Implicit Declaration—
Procedures Only
You cannot implicitly declare a function; however, you can implicitly declare a
procedure.
If a source file does not begin with an explicit PROCEDURE statement, then NCL
assumes that the source file is an external procedure. NCL implicitly attaches the
name of the source file to an implicit PROCEDURE statement. The name of the source
file becomes the procedure label. As a result, the name of the top-level internal
procedure has the same name as the source file. NCL assumes that the last statement
in the source file is an END statement.
This means that a source file consisting only of a sequence of NonStop NET/MASTER
MS commands (executed with either the CMD core statement or the INTCMD verb)
can be called as a valid external procedure.
The following example shows an NCL procedure with an implicit declaration:
/* Implicit "zex0606n: PROCEDURE" statement */
CMD "SYSPARMS PRELOAD=nnmproc1"
CMD "SYSPARMS PRELOAD=nnmproc2"
CMD "SYSPARMS PRELOAD=nnmproc3"
/* Implicit "END zex0606n" statement */
The comments indicate the position of the implicit PROCEDURE and END statements.
This NCL procedure executes a series of SYSPARMS PRELOAD commands to preload
the NCL procedures NNMPROC1, NNMPROC2, and NNMPROC3.