NET/MASTER Network Control Language (NCL) Reference Manual
Variable Name Syntax
Variables
106126 Tandem Computers Incorporated 9–9
In a complex variable name, a nested variable reference can be followed by a suffix
unless the nested variable reference is the first part of the complex name. This rule is
identical to the one for numeric names in a complex variable. The following example
is a valid complex variable:
&ABC&(123)&456F&G
The following example is an invalid variable because the nested reference comes first:
&(123)&456F&G
Nested variables allow stem and compound variables, including system variables, to
be nested within a complex compound or complex variable. The following example
shows a compound variable that contains the system variable &SYS.USER.ID:
&FIRST_PART.&(SYS.USER.ID)
The following example shows a complex variable that contains the compound variable
NEXT.ONE:
&FIRST_ONE&(NEXT.ONE).LAST_ONE
Nested variables may themselves be nested. NCL guarantees up to three levels of
nesting. Further nesting levels depend on the complexity of the variables you want to
nest. A compilation error results if the nesting level is exceeded. The following
example shows a nested variable with three levels of nesting:
&ABC&(FIRST_PART&(MIDDLE_PART&(last_PART)SUFFIX1)SUFFIX2)
Nested variables are mainly used to incorporate compound variables into substitution
by explicitly delimiting a compound variable name with parentheses.
Nested variables eliminate the need to assign the value of the compound variable to a
temporary simple variable before incorporating the value into a variable name. Here
is an example that shows you a nested variable that incorporates the system variable
&SYS.USER.ID as part of the name:
&X = &GLBL.&(SYS.USER.ID).XYZ
If you log on as NMTHY, &X takes the value of &GLBL.NMTHY.XYZ.
In addition, just as you can use simple or complex variables as part of a compound
variable, nested variables allow you to use a compound variable as part of a complex
variable. For example, you do not have to use the following two assignment
statements to obtain the value of the value in &RECORD.FIELD.1:
&A = &RECORD.FIELD.1
&B = &&A
Instead, you can use the following single assignment statement to obtain the same
result:
&B = &&(RECORD.FIELD.1)