Managing Memory and Data Access
16.4 Using Alignment Directives, Qualiers, and Flags
Example 161 Using *DC SET ALIGNMENT Directives
.
.
1
.*DC SET ALIGNMENT
2
01 comp-group.
02 cg-x1 pic x.
02 cg-c1 pic 9(1) comp.
*DC SET NOALIGNMENT
3
01 comp-group-2.
02 cg-x2 pic x.
02 cg-c2 pic 9(1) comp.
*DC END-SET ALIGNMENT
4
01 comp-group-3.
02 cg-x3 pic x.
02 cg-c3 pic 9(1) comp.
*DC END-SET ALIGNMENT
5
01 comp-group-4.
02 cg-x4 pic x.
02 cg-c4 pic 9(1) comp.
1Initially, OpenVMS VAXcompatible alignment is specified either by
NOALIGNMENT or the absence of ALIGN on the compile command.
2The SET ALIGNMENT directive specifies alignment along natural
boundaries, superseding the initial OpenVMS VAXcompatible alignment.
3The SET NOALIGNMENT directive specifies VAXcompatible alignment; data
is now byte-aligned.
4The END-SET ALIGNMENT directive terminates the alignment specified
with the previous SET directive (3SET NOALIGNMENT). Alignment is once
again along the natural boundaries as specified by 2, the SET ALIGNMENT
directive.
5This END-SET ALIGNMENT directive terminates the alignment specified
with the original directive (2SET ALIGNMENT). Alignment is now
OpenVMS VAXcompatible as specified by the default command-line option.
16.4.3 Comparing Alignment Directive Effects
The alignment examples that follow illustrate the following important points:
Compaq COBOL for OpenVMS VAXand Compaq COBOL align 01 (and 77)
data items along different boundaries, as follows:
Compaq COBOL for OpenVMS VAX aligns 01 data records and items
along longword boundaries. It byte-aligns all other fields unless SYNC
has been specified.
Compaq COBOL aligns 01 records and items along quadword boundaries.
It byte-aligns all other fields unless SYNC or the alignment option has
been specified.
168Managing Memory and Data Access