Managing Memory and Data Access
16.3 Aligning Data for Performance and Compatibility
Table161 Boundaries for Naturally Aligned Binary Data
COBOL
USAGE PICTURE
Declaration OpenVMS Alpha
Standard Data Type Natural
Alignment Allocated
Storage
DISPLAY PIC A
PIC X
PIC 9
PIC EDITED
8-bit character string BYTE 1 byte
COMP PIC [S]9(1-4) 16-bit word integer WORD 2 bytes
PIC [S]9(5-9) 32-bit longword integer LONGWORD 4 bytes
PIC [S]9(10-18) 64-bit quadword integer QUADWORD 8 bytes
PIC [S]9(19-31) 128-bit octaword integer QUADWORD 16bytes
COMP-1 Not applicable 32-bit VAXF-floating LONGWORD 4 bytes
32-bit IEEE S-floating LONGWORD 4 bytes
COMP-2 Not applicable 64-bit VAXD-floating QUADWORD 8 bytes
64-bit VAXG-floating QUADWORD 8 bytes
64-bit IEEE T-floating QUADWORD 8 bytes
INDEX Not applicable 32-bit longword integer LONGWORD 4 bytes 1
POINTER Not applicable 32-bit longword integer LONGWORD 4 bytes 2
1On the OpenVMS Alpha system, USAGE IS INDEX is allocated as a longword integer for OpenVMS VAXcompatibility.
On the Tru64UNIX system, it is allocated as a 64-bit quadword integer, with 8 bytes of storage.
2On the OpenVMS Alpha system, Compaq COBOL allocates 4 bytes for POINTER data to maintain Compaq COBOL
for OpenVMS VAXcompatibility. On the Tru64 UNIX system, it allocates 8 bytes for POINTER data (a 64-bit quadword
integer).
16.3.2 DataField Padding
In Compaq COBOL, all 01 and 77-level data items are always aligned on
quadword boundaries. With Alpha natural alignment and padding invoked, the
lengths of all data-items are compiled to be multiples of the greatest alignment of
any subordinate elementary field.
The compiler will flag (with an Informational diagnostic) all fields that might
incur side effects when compiled with alignment and padding enabled.
16.3.3 AlignmentDirectives, Qualiers, and Flags
Within your program, you can specify alignment with the alignment directives,
which consist of structured comments embedded within the DATADIVISION of
the program source.
The SYNCHRONIZED clause, which also aligns binary data on natural
boundaries, is included in both Compaq COBOL and Compaq COBOL for
OpenVMS VAX. See the Compaq COBOL Reference Manual for complete
information on the SYNCHRONIZED clause.
When you compile a COBOL program, you can use the /ALIGNMENT qualifier
or the /ALIGNMENT=PADDING qualifier on WindowsNT and OpenVMS Alpha
systems and
-align
or
-align pad
on Tru64 UNIX systems to specify aligned
elementary data items or naturally aligned and padded record layouts for optimal
performance. If you do not specify this option, the default alignment is used,
which is OpenVMS VAXcompatible record layouts for compatibility with Compaq
COBOL for OpenVMS VAXand other OpenVMS VAX languages.
164Managing Memory and Data Access