pTAL Conversion Guide

Structures
pTAL Conversion Guide527302-002
11-17
FIELDALIGN Compiler Directive
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.
If you specify FIELDALIGN(NODEFAULT), you must specify a FIELDALIGN clause on
every definition structure and template structure declaration in your program. You do
not, however, have to specify a FIELDALIGN clause on substructures, even if you
specify FIELDALIGN(NODEFAULT).
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.
Using Field Alignment
As their names imply, you use SHARED2 and SHARED8 field alignment for structure
data that is shared by processes running on TNS and native architectures. You can
share data by interprocess communication or by accessing it on a shared storage
medium such as disk or tape.
Your program might use library routines that require that structure data be in a
SHARED2 or SHARED8 format. If you use library routines that include structures that
specify SHARED2 or SHARED8, you might need to declare your structures with the
same field alignment as the structures in the library.
Use AUTO field alignment for a structure that you use only locally—that is, only within
a process—not between processes of different types.
If more than one program uses the same source file, you might want to include a
FIELDALIGN clause on every structure declaration in the source file. This ensures that
the field alignment of every structure is consistent across all programs that compile the
source file. If you do not specify a FIELDALIGN clause, each structure will use the
current setting of the FIELDALIGN compiler directive, which might be different for
different compilations.
Topics:
Using SHARED2 Field Alignment on page 11-18
Using SHARED8 Field Alignment on page 11-19
Using PLATFORM Field Alignment on page 11-22
Using AUTO Field Alignment on page 11-23
Differences Between PLATFORM and AUTO Alignment on page 11-23
Field Alignment in TAL on page 11-23