NET/MASTER Network Control Language (NCL) Programmer's Guide
Sharing Variables to Procedures and Functions
Procedures and Functions
106160 Tandem Computers Incorporated 6–33
You cannot include the following variables in a share list:
&abc&xyz /* Complex variable */
&abc.xyz /* Compound variable */
&abc&(xyz) /* Nested variable */
&glblabc /* Global variable */
&sys.retcode /* System variable */
The following examples specify variables in a share list:
CONTROL SHRVARS=&a
CONTROL NOSHRVARS=&a
CONTROL SHRVARS=(&a,&b*,&c.)
CONTROL NOSHRVARS=(&a,&b*,&c.)
CALL PROCEDURE proc1 SHARE &a
CALL PROCEDURE proc1 NOSHARE &a
CALL PROCEDURE proc1 SHARE &a, &b*, &c.
CALL PROCEDURE proc1 NOSHARE &a, &b*, &c.
proc1: PROCEDURE SHARE &a, &b*, &c.
proc1: PROCEDURE NOSHARE &a, &b*, &c.
func1: FUNCTION SHARE &a, &b*, &c.
func1: FUNCTION NOSHARE &a, &b*, &c.
Hint To improve the performance of an NCL process, share as few variables as possible, share simple
variables or stem variables, and avoid sharing generic variables (a generic variable is a variable prefix,
ending with an asterisk (*)). When sharing many variables, either define all variables to be shared under
one stem variable and share only the stem to the callee procedure or function, or use a subroutine instead
to perform the required task. (While not recommended, sharing all variables (by using &*) improves
performance over sharing many variables.)
Using the NO Keyword in a Share List
If either the caller or callee procedure or function specifies the NO keyword, no
variable sharing is performed. This is the default. If you use the NO keyword, it must
be the only entry in the share list.
The following examples specify the NO keyword in a share list:
CONTROL SHRVARS=NO
CONTROL NOSHRVARS=NO
CALL PROCEDURE proc1 SHARE NO
CALL PROCEDURE proc1 NOSHARE NO
proc1: PROCEDURE SHARE NO
proc1: PROCEDURE NOSHARE NO
func1: FUNCTION SHARE NO
func1: FUNCTION NOSHARE NO