Managing Memory and Data Access
16.3 Aligning Data for Performance and Compatibility
Table 16–1 Boundaries for Naturally Aligned Binary Data
COBOL
PICTURE
USAGE
Declaration
DISPLAY
PIC A
PIC X
PIC 9
PIC EDITED
COMP
PIC [S]9(1-4)
PIC [S]9(5-9)
PIC [S]9(10-18)
PIC [S]9(19-31)
COMP-1
Not applicable
COMP-2
Not applicable
INDEX
Not applicable
POINTER
Not applicable
1
On the OpenVMS Alpha system, USAGE IS INDEX is allocated as a longword integer for OpenVMS VAX compatibility.
On the Tru64 UNIX system, it is allocated as a 64-bit quadword integer, with 8 bytes of storage.
2
On the OpenVMS Alpha system, Compaq COBOL allocates 4 bytes for POINTER data to maintain Compaq COBOL
for OpenVMS VAX compatibility. On the Tru64 UNIX system, it allocates 8 bytes for POINTER data (a 64-bit quadword
integer).
16.3.2 Data Field 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 Alignment Directives, Qualifiers, and Flags
Within your program, you can specify alignment with the alignment directives,
which consist of structured comments embedded within the DATA DIVISION 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 Windows NT and OpenVMS Alpha
systems and
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 VAX compatible record layouts for compatibility with Compaq
COBOL for OpenVMS VAX and other OpenVMS VAX languages.
16–4 Managing Memory and Data Access
OpenVMS Alpha
Standard Data Type
8-bit character string
16-bit word integer
32-bit longword integer
64-bit quadword integer
128-bit octaword integer
32-bit VAX F-floating
32-bit IEEE S-floating
64-bit VAX D-floating
64-bit VAX G-floating
64-bit IEEE T-floating
32-bit longword integer
32-bit longword integer
or
on Tru64 UNIX systems to specify aligned
-align
-align pad
Natural
Allocated
Alignment
Storage
BYTE
1 byte
WORD
2 bytes
LONGWORD
4 bytes
QUADWORD
8 bytes
QUADWORD
16 bytes
LONGWORD
4 bytes
LONGWORD
4 bytes
QUADWORD
8 bytes
QUADWORD
8 bytes
QUADWORD
8 bytes
1
LONGWORD
4 bytes
2
LONGWORD
4 bytes
Need help?
Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?
Questions and answers