pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

substructure but might not be well-aligned with respect to the base of the SHARED2 structure.
Performance will be somewhat degraded when fields in the substructure are referenced.
If a SHARED2 substructure is contained in a SHARED8 structure (or in an AUTO structure), fields
in the SHARED2 substructure will be well-aligned with respect to the base of the SHARED2
substructure but might not be well-aligned with respect to the base of the SHARED8 structure.
Performance will be significantly degraded when fields in the substructure are not well-aligned for
SHARED8 access. Each such reference will cause a trap to the millicode exception handler to
resolve the reference. Your program will behave correctly but will be significantly slower than it
would without the trap.
Example 62 AUTO Field Alignment in Structure (Error)
STRUCT s FIELDALIGN(SHARED8);
BEGIN
STRUCT s1 FIELDALIGN(AUTO); ! ERROR: Substructure cannot be
BEGIN ! FIELDALIGN(AUTO)
...
END;
END;
The compiler pads SHARED2 structures and substructures with an extra byte if the end of the last
field in the structure or substructure ends at an odd-byte address, unless the structure has 1-byte
alignment—that is, all fields in the structure or substructure are STRINGs or UNSIGNED(1-8).
STRING fields in structures can begin at any byte offset.
FIELDALIGN Clause
You use a FIELDALIGN clause in a structure declaration to specify how you want pTAL to align the
fields in the structure. Fields can be aligned for:
FIELDALIGN ClauseAccess
FIELDALIGN(AUTO)Exclusive, optimized for best resource utilization on each architecture
FIELDALIGN(SHARED2)Shared between pTAL and TAL programs
FIELDALIGN(PLATFORM)Shared by program modules written in different programming languages
and running on the same architecture
FIELDALIGN(SHARED8)Shared between TNS, TNS/R, and TNS/E architecture with optimal
performance on TNS/R and TNS/E architecture
FIELDALIGN Compiler Directive
As with the FIELDALIGN clause, the parameters to the FIELDALIGN compiler directive include
SHARED2, SHARED8, PLATFORM, and AUTO. In addition, you can specify NODEFAULT as the
parameter to the FIELDALIGN compiler directive.
You can specify only one FIELDALIGN directive within a compilation, and it must precede all data,
block, and procedure declarations. Only comments, blank lines, and other directives can precede
a FIELDALIGN directive.
The default value of the FIELDALIGN directive is AUTO.
If you specify the FIELDALIGN (NODEFAULT) compiler directive, pTAL requires you to specify a
FIELDALIGN clause on every structure declaration. You might use the FIELDALIGN (NODEFAULT)
directive to ensure that you do not inadvertently omit a FIELDALIGN clause on any structure.
If you do not specify a FIELDALIGN (NODEFAULT) directive, pTAL does not require you to specify
a FIELDALIGN clause on each structure declaration.
FIELDALIGN Clause 127