3 comparing alignment directive effects – Compaq COBOL AAQ2G1FTK User Manual

Page 524

Advertising
background image

Managing Memory and Data Access
16.4 Using Alignment Directives, Qualifiers, and Flags

Example 16–1 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.

1

Initially, OpenVMS VAX compatible alignment is specified either by
NOALIGNMENT or the absence of ALIGN on the compile command.

2

The SET ALIGNMENT directive specifies alignment along natural
boundaries, superseding the initial OpenVMS VAX compatible alignment.

3

The SET NOALIGNMENT directive specifies VAX compatible alignment; data
is now byte-aligned.

4

The END-SET ALIGNMENT directive terminates the alignment specified
with the previous SET directive (

3

SET NOALIGNMENT). Alignment is once

again along the natural boundaries as specified by

2

, the SET ALIGNMENT

directive.

5

This END-SET ALIGNMENT directive terminates the alignment specified
with the original directive (

2

SET ALIGNMENT). Alignment is now

OpenVMS VAX compatible 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 VAX and 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.

16–8 Managing Memory and Data Access

Advertising