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

Sharing Variables to Procedures and Functions
Procedures and Functions
106160 Tandem Computers Incorporated 6–35
Using the CALLER Keyword in a Share List
When any procedure or function uses the CALLER keyword in a share list
specification, the keyword is logically replaced by the contents of the share list
provided by the caller at the time the current procedure or function is called.
The CALLER keyword does not preclude the use of other variable specifications in a
share list. If the CALLER keyword is used in a share list and the caller provides a
NOSHARE list, the CALLER keyword is logically replaced by an empty list.
The following examples specify the CALLER keyword in a share list:
CONTROL SHRVARS=CALLER
CONTROL NOSHRVARS=CALLER
CONTROL SHRVARS=(&a,&b*,CALLER,&c.)
CONTROL NOSHRVARS=(&a,CALLER,&b*,&c.)
CALL PROCEDURE proc1 SHARE &a,CALLER
CALL PROCEDURE proc1 NOSHARE CALLER,&a
CALL PROCEDURE proc1 SHARE &a, CALLER, &b*, &c.
CALL PROCEDURE proc1 NOSHARE &a, &b*, CALLER, &c.
proc1: PROCEDURE SHARE CALLER, &a, &b*, &c.
proc1: PROCEDURE NOSHARE &a, &b*, &c., CALLER
func1: FUNCTION SHARE &a, CALLER, &b*, &c.
func1: FUNCTION NOSHARE &a, &b*, CALLER, &c.
The following example shows how specifying the CALLER keyword on a procedure
declaration affects variable sharing:
zex0618n: PROCEDURE
/* The CALLER keyword in a share list */
&var_1 = One
SAY "Pre-procedure call var_1 is "&var_1
CALL control_proc
SAY "Post-procedure call var_1 is "&var_1
CALL control_proc SHARE &var_1
SAY "Post-procedure call var_1 is "&var_1
control_proc: PROCEDURE SHARE CALLER, &var_2, &var_3
&var_1 = Two
END control_proc
END zex0618n