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

Sharing Variables to Procedures and Functions
Procedures and Functions
6–28 106160 Tandem Computers Incorporated
Overriding the CONTROL Verb When Calling a Function. There is only one way to override
the default setting of the CONTROL verb when you call a function—by using the
CONTROL verb to specify a share list. You cannot override the default setting of the
CONTROL verb on the function declaration of the callee function.
The following code segment shows how to override the default setting of the
CONTROL statement when calling a function:
CONTROL NOSHRVARS /* Default CONTROL setting */
CONTROL SHRVARS (&var_1) /* Overrides CONTROL NOSHRVARS */
&a = control_func() /* Calls CONTROL_FUNC */
control_func: FUNCTION /* Function declaration */
The following example shows this method of overriding in a complete procedure:
zex0625n: PROCEDURE
/* Sharing with the CONTROL verb */
/* Default is CONTROL NOSHRVARS */
&var_1 = One
SAY "Pre-function call var_1 is "&var_1
&a = control_func()
SAY "Post-function call (NOSHRVARS), var_1 is "&var_1
CONTROL SHRVARS (&var_1)
&a = control_func()
SAY "Post-function call (SHRVARS), var_1 is "&var_1
control_func: FUNCTION
&var_1 = Two
RETURN (&var_1)
END control_func
END zex0625n