TACL Reference Manual
Variables
HP NonStop TACL Reference Manual—429513-018
4-14
Declaring a Structure Body
Considerations
•
The BEGIN ... END form can contain declarations for:
°
Simple data items
°
Array data items
°
Substructures
°
FILLER bytes
°
Redefinitions
•
The use of LIKE conserves variable space, because like structures and
substructures use the same structure-accessing information. Accessing
information is not part of a particular structure. The original structure and all like
structures merely point to the access information. TACL automatically releases
accessing information when it is no longer needed.
•
Structure-accessing information must be in the same segment as any structure
using it. TACL automatically copies the information to the segment where it is
needed, even if it has copied it before; this means that if you have a segment full of
definitions to be used by structures in another segment, you should define one
structure in that other segment like the original definition, then define any additional
structures like that first copy. This precaution ensures that there is only one copy of
the structure-accessing information.
•
If structure A is defined to be like structure B, changing the definition of B later
does not change the definition of A because, although it creates new structure-
accessing information for B, A still refers to the original accessing information.
•
When manipulating structures in TACL, use data in an appropriate external format.
For instance, store and retrieve file names in STRUCTs in external format,
although TACL maintains file names in STRUCTs in internal format. In TACL, there
is a difference between 12 integers and an internal-format file name; each occupy
the same amount of storage, but their representation to a TACL programmer is
different.
•
TACL aligns structures on word boundaries and allocates storage within a
structure:
°
BYTE and CHAR data items in a structure are byte-aligned; all other items are
multiple-word items and are word-aligned.
°
A substructure defined by LIKE is word-aligned.
°
A substructure is word-aligned if the first item it contains is word-aligned;
otherwise, the substructure is byte-aligned.
°
If a substructure is an array with more than one occurrence, contains a word-
aligned item, and would otherwise contain an odd number of bytes, TACL
automatically appends one FILLER byte to the substructure to make its length