TAL Programmer's Guide
Declaring Simple Variables and Arrays in Structures
Using Structures
096254 Tandem Computers Incorporated 8–9
To declare a standard indirect structure, precede the structure identifier with the
standard indirection symbol (.), as shown in the preceding example.
For very large structures, you should use extended indirection. When you declare one
or more extended indirect structures (or arrays), the compiler allocates the automatic
extended data segment. If you also must allocate an explicit extended data segment,
follow the instructions given in Appendix B, “Managing Addressing.”
To declare an extended indirect structure, precede the structure identifier with the
extended indirection symbol (.EXT):
STRUCT record (
*
); !Declare template structure
BEGIN
STRING name[0:19];
STRING addr[0:29];
INT acct;
END;
STRUCT .EXT customer (record) [0:49];
!Declare extended indirect
! referral structure
Allocating Referral
Structures
The compiler allocates storage for each referral structure based on the following
characteristics:
The addressing mode and number of occurrences specified in the new declaration
The layout of the previous declaration
In all other ways, allocation of referral structures is the same as for definition
structures, as described earlier in this section.
Addressability of
Structures
The zeroth occurrence of a structure must always be addressable, as described for
definition structures.
Declaring Simple
Variables and Arrays
in Structures
You declare simple variables and arrays inside and outside a structure in the same
way, except that inside a structure:
You cannot initialize simple variables or arrays.
You cannot declare indirect arrays or read-only arrays.
You can specify bounds of [n:n-1]; the array is addressable but uses no memory.
For example, you can declare simple variables and arrays in a structure like this:
STRUCT .record; !Declare definition structure
BEGIN
STRING name[0:19]; !Declare array
STRING addr[0:29]; !Declare array
INT acct; !Declare simple variable
END;
A structure that contains arrays is also known as an array of arrays.