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

Sharing Variables to Procedures and Functions
Procedures and Functions
6–26 106160 Tandem Computers Incorporated
The following screen shows the results of executing the procedure:
(15:32) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0614N
Pre-procedure call var_1 is One
Post-procedure call (NOSHRVARS), var_1 is One
Post-procedure call (SHRVARS), var_1 is Two
NNM1005 START ZEX0614N PROCESSING COMPLETE. NCLID 000430
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>
When the CONTROL_PROC procedure is called for the first time, the default setting
of CONTROL NOSHRVARS prevents variables being shared to CONTROL_PROC.
Accordingly, the value of &VAR_1 does not change. When the CONTROL_PROC
procedure is called for the second time, the setting of CONTROL SHRVARS explicitly
enables variable sharing, and so the value of &VAR_1 is changed.
The following code segment shows the second way of overriding the default setting of
the CONTROL statement when calling a procedure:
CONTROL NOSHRVARS /* Default CONTROL setting */
CALL control_proc SHARE &var_1 /* Overrides CONTROL */
/* NOSHRVARS and calls */
/* CONTROL_PROC */
control_proc: PROCEDURE /* Procedure declaration */