TAL Programmer's Guide
Equivalencing Simple Variables
Using Equivalenced Variables
10–2 096254 Tandem Computers Incorporated
Equivalencing
Simple Variables
You can equivalence a new simple variable to a previously declared variable as listed
in Table 10-1 earlier in this section.
Declaring Equivalenced
Simple Variables
To declare an equivalenced simple variable, specify:
Any data type but UNSIGNED
The identifier of the new simple variable
An equal sign (=)
The identifier of the previous variable
For portability to future software platforms, declare equivalenced variables that fit
within the previous variable.
Equivalencing INT Simple Variables
For example, you can equivalence an INT variable (WORD2) to a previous INT
variable (WORD1):
INT word1;
INT word2 = word1;
WORD1 WORD2
300
Equivalencing STRING Simple Variables
You can equivalence a STRING variable (S2) to a previous STRING variable (S1):
STRING s1 := "A";
STRING s2 = s1;
301
S1 ? S2
Equivalencing Mixed Simple Variables
The data type of the new variable can differ from the data type of the previous
variable. For example, you can equivalence STRING and INT(32) variables to a
previous INT array. (The middle box looks like an array, but it is an equivalenced
STRING simple variable shown with indexes.)
INT w[0:1];
STRING b = w[0];
INT(32) d = b;
w[0]
w[1]
B[0] B[1]
B[2] B[3]
302
D