TAL Programmer's Guide
Declaring Referral Structures
Using Structures
8–8 096254 Tandem Computers Incorporated
Declaring Referral
Structures
A referral structure allocates storage for a structure whose layout is the same as that of
a specified structure or structure pointer.
To declare a single occurrence (copy) of a referral structure, specify:
The keyword STRUCT
The structure identifier, usually preceded by an indirection symbol (. or .EXT)
A referral that provides the structure layout—enclose the identifier of an existing
definition structure, template structure, or structure pointer in parentheses
For example, you can declare referral structure NEW_STRUCT to use the layout of
OLD_STRUCT:
STRUCT .new_struct (old_struct); !Declare referral structure
Specifying Structure
Occurrences
A referral structure that contains multiple occurrences is an array of structures. To
indicate multiple occurrences, specify the lower and upper bounds in the structure
declaration. These bounds represent the indexes of the first and last structure
occurrences you want allocated. Specify the bounds as INT constant expressions in the
range –32,768 through 32,767, separated by a colon and enclosed in brackets. The
default bounds are [0:0] (one structure occurrence).
For example, to declare an array of referral structures that consists of 50 occurrences of
the structure, specify structure bounds such as [0:49]. The following example declares:
A template structure named RECORD
A referral structure named CUSTOMER that uses the layout of RECORD for 50
occurrences:
STRUCT record (
*
); !Declare template structure
BEGIN
STRING name[0:19];
STRING addr[0:29];
INT acct;
END;
STRUCT .customer (record) [0:49];
!Declare referral structure
The size of one occurrence of a structure must not exceed 32,767 bytes. In the
preceding example, the size of each structure occurrence is 52 bytes. The size of the
entire structure, including all 50 occurrences, is 2,600 bytes.
Using Indirection You should use indirection for most global and local structures, because storage areas
for direct global and local variables are limited. You access indirect structures by
identifier as you do direct structures.
Do not use indirection for sublocal structures, because sublocal storage has no
secondary area.