NET/MASTER Network Control Language (NCL) Programmer's Guide
Sharing Variables to Procedures and Functions
Procedures and Functions
6–30 106160 Tandem Computers Incorporated
Sharing Through a Procedure or Function Declaration
When you declare a procedure, by using the PROCEDURE core statement, or a
function, by using the FUNCTION core statement, you can specify whether it can
share variables or not by using either the SHARE or NOSHARE keyword.
The following example shows how specifying the SHARE keyword on a procedure
declaration affects variable sharing when a procedure is called:
zex0615n: PROCEDURE
/* Sharing through a PROCEDURE declaration */
&var_1 = One
SAY "Pre-procedure 1 call var_1 is "&var_1
CALL control_proc1
SAY "Post-procedure 1 call var_1 is "&var_1
CALL control_proc2
SAY "First post-procedure 2 call var_1 is "&var_1
CONTROL SHRVARS=&var_1
CALL control_proc2
SAY "Second post-procedure 2 call var_1 is "&var_1
control_proc1: PROCEDURE
&var_1 = Two
END control_proc1
control_proc2: PROCEDURE SHARE &var_1
&var_1 = Three
END control_proc2
END zex0615n
The following screen shows the results of executing the procedure:
(10:25) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0615N
Pre-procedure 1 call var_1 is One
Post-procedure 1 call var_1 is One
First post-procedure 2 call var_1 is One
Second post-procedure 2 call var_1 is Three
NNM1005 START ZEX0615N PROCESSING COMPLETE. NCLID 001008
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>