TAL Programmer's Guide
Declaring Redefinitions
Using Structures
096254 Tandem Computers Incorporated 8–21
Declaring
Redefinitions
A redefinition declares a new identifier and sometimes a new description for a
previously declared item in the same structure. The new item or the previous item can
be a simple variable, array, pointer, or substructure.
The new item must be at the same BEGIN-END level in a structure as the previous
item. The new item must also be of the same length or shorter than the previous item.
The subsections that follow describe how you declare and access redefinitions. Some
examples include diagrams that show how a redefinition relates to the previous item.
In each diagram:
The shaded box represents the previous item (the allocated item).
The unshaded box represents the new item (the redefinition).
Unless otherwise noted, the diagrams refer to memory locations in the primary area of
the user data segment. Here is an example diagram:
393
A[2]
A[4]
B[1]
B[3]
A[3]
B[0]
B[2]
/ / /
C[1]
D
A[0] A[1]
C[0]
STRUCT array_redefinition;
BEGIN
STRING a[0:4];
STRING b[0:3];
INT c[0:1] = a;
STRING d = b;
END;
Simple Variables or
Arrays as Redefinitions
To declare a new simple variable or array that redefines a previous item within the
same structure, specify:
Any data type (except UNSIGNED)
The identifier of the new simple variable or array
For an array, its bounds—if you omit the bounds, the default bounds are [0:0] (one
element)
An equal sign (=)
The identifier of a previous item at the same BEGIN-END level of a structure—the
previous item can be a simple variable, array, pointer, or substructure
For example, you can declare NEW_VAR to redefine OLD_VAR as follows:
STRUCT simple_variable_redefinition;
BEGIN
INT old_var;
STRING new_var = old_var; !Redefinition
END;