NET/MASTER Network Control Language (NCL) Reference Manual

Variable Name Substitution
Variables
9–10 106126 Tandem Computers Incorporated
Some examples of nested variables are:
Example Comment
&(A) This is the same as &A.
&(&A) This is similar to &&A.
&X.&(name).&number A nested compound variable reference.
&GLBL.&(SYS.USER.ID).XYZ A nested system variable.
Variable Name
Substitution
This subsection discusses how a variable name is constructed when parts of it are
unknown. It begins by distinguishing between variable name substitution and the
process of determining the value of a variable. It then discusses the following rules for
variable name substitution:
Simple variables
Complex variables
Stem variables
Compound variables
Nested variables
Substitution with braces ({ })
Substitution and
Determining the Value of a
Variable
Variable name substitution is the process of determining the final form of a variable
name. The process involves replacing the parts of a variable name that are themselves
variable references with their values. For example, the following complex nested
compound variable has two substems, &(BCD) and &D&E, that are unknown and
require variable substitution:
&A.&(BCD).&D&E.XYZ
Variable name substitution occurs only when there are multiple ampersands after the
leading ampersand in a variable name. This is the only time that some part of a
variable name is unknown. This means that no substitution is required to reference a
simple variable or a simple stem variable.
The number of references that are required to determine the final form of the name of
a variable is equal to the number of ampersands in the original variable name
(excluding the leading ampersand). The final name of a variable of any type must be
less than or equal to 250 characters (excluding the initial ampersand).
Variable name substitution does not mean determining the value of the final variable.
This occurs after the final form of the name of a variable has been determined.
Whether it occurs depends on context. Consider the following statement:
&A = &A + 1
The variable &A on the right side of the assignment statement is looked up to produce
a value. After addition, the value is assigned to the variable &A on the left side of the
statement. However, &A on the left side is not looked up to produce its value; rather,
its location is recalled so that a value can be assigned into it.