Managing Memory and Data Access
16.3 Aligning Data for Performance and Compatibility
In addition to the primary goal of optimum performance, specifying data
alignment offers the following advantages:
•
Ease of use and conversion—You might need to make a minimal number
of changes to existing source files before compiling them with the Compaq
COBOL compiler. In some cases, all you need to do is specify the
-align
flag
or the /ALIGNMENT qualifier with or without the padding option when you
compile.
•
Flexibility—You can specify VAX compatible alignment (byte alignment) or
natural alignment on a record-by-record basis. For example, you can specify
VAX compatible alignment for files shared by both compilers and natural
alignment for Compaq COBOL-only files and records.
Note
The two types of padding (use of alignment with the PADDING option, or
use of *DC SET PADALIGN) are not recommended in a COBOL program
that contains the REDEFINES or RENAMES syntax.
16.3.4 Specifying Alignment at Compile Time
The result of the alignment command-line option is identical on the Windows NT,
OpenVMS Alpha, and the Tru64 UNIX operating systems.
On Windows NT and OpenVMS Alpha systems, the /ALIGNMENT qualifier
used with the COBOL command aligns data on Alpha natural boundaries and
optionally pads data structures that contain them, in conformity with the Compaq
Alpha Calling Standards. The format of the /ALIGNMENT qualifier is as follows:
/ALIGNMENT[=[NO]PADDING] or /NOALIGNMENT
On Tru64 UNIX systems, you use the
-align
flag with the
cobol
command
to align elementary data items on Alpha natural boundaries and optionally to
pad data structures which contain them, in conformity with the Compaq Alpha
Calling Standards. The format of the
-align
flag is as follows:
-align [padding]
On all three patforms, the default is alignment on Alpha natural boundaries
and no padding of interior or terminal fields (for 01-level data items and data
structures).
The alignment command-line qualifier or flag specifies the minimum alignment
for data items specified within the program source when no additional alignment
information has been specified. You can specify the minimum alignment of
specific data items within your program by including compiler directives in the
program source.
The
-align
flag or the /ALIGNMENT qualifier aligns all COMP, COMP-1, COMP-
2, INDEX, and POINTER data along natural boundaries. (See Table 16–1.)
By default, alignment is turned off and data is aligned on byte boundaries.
The alignment specified in the compile command is in force throughout a
given compilation, except as modified by any compiler directives. In addition,
the alignment of elementary binary data that has been specified with the
SYNCHRONIZED clause is unchanged.
Managing Memory and Data Access 16–5