beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 523

background image

Managing Memory and Data Access

16.4 Using Alignment Directives, Qualifiers, and Flags

Table 16–2 Alignment and Padding Order of Precedence

Compiler Directives

Command line
Qualifier and
Option

No Directive
in Effect

*DC SET
ALIGNMENT

*DC SET
PADALIGN

*DC SET
NOALIGN

(none)

None

Align
elementary
data items.

Align and pad
elementary
data items and
structures.

None

/ALIGNMENT

-align

Align
elementary
data items.

Align
elementary
data items.

Align and pad
elementary
data items and
structures.

None

/ALIGN=PAD

-align pad

Align and pad
elementary
data items and
structures.

Align
elementary
data items and
structures.

Align and pad
elementary data
items.

None

16.4.2 Nesting Alignment Directives

Alignment directives located within the source program alter the current
alignment by specifying a new alignment. This new alignment remains in effect
(except for data specified with SYNCHRONIZED, which remains unchanged)
until changed precedence, or until the beginning of the next file specified in a
comma list.

You can nest alignment directives within a program to specify different
alignments for selected sets of data. Alignment directives modify the current
alignment in the following ways:

A SET ALIGNMENT (or SET NOALIGNMENT) directive. At this point in
the program source the alignment specified by this directive becomes the
current alignment.

An END-SET ALIGNMENT directive. At this point, the immediately
preceding SET ALIGNMENT (or SET NOALIGNMENT) directive is closed.
The current alignment now becomes one of the following:

— The alignment specified by the closest previous unclosed alignment

directive

— The alignment specified by the command-line option if no previous

alignment directive exists

The beginning of the next file specified in a comma list (on the Compaq
COBOL command line). This event closes all of the preceding alignment
directives. The alignment specified with the command-line option becomes
the current alignment.

Example 16–1 shows an example of nested alignment directives in source code.

Managing Memory and Data Access 16–7