Compaq AAQ2G1FTK Marine Radio User Manual


 
Managing Memory and Data Access
16.4 Using Alignment Directives, Qualiers, and Flags
The effects of the SYNCHRONIZED clause, the alignment command-line
option, and the SET ALIGNMENT directive on elementary data alignment
are identical.
Example 16–2 through Example 16–6 show a comparison of the use and results of
several alignment cases. They are applicable to both Tru64 UNIX and OpenVMS
Alpha. Example 16–2 shows the effects of the SYNCHRONIZED clause in
program source, as compared with the /ALIGNMENT qualifier on the command
line.
Example 162 Using /ALIGNMENT with SYNCHRONIZED
01 comp-group.
02 cg-x1 pic x.
1
02 cg-c1 pic 9(1) comp.
2
02 cg-c3 pic 9(3) comp.
3
02 cg-c7 pic 9(7) comp.
4
02 cg-c12 pic 9(12) comp.
5
01 comp-group-synch.
02 cg-x1-synch pic x.
6
02 cg-c1-synch pic 9(1) comp synchronized.
7
02 cg-c3-synch pic 9(3) comp synchronized.
8
02 cg-c7-synch pic 9(7) comp synchronized.
9
02 cg-c12-synch pic 9(12) comp synchronized.
10
The data is aligned as shown in the following examples using different alignment
configurations. In the accompanying data diagrams, a number ( n ) indicates that
that byte is occupied by the nth field of the record, and a dash ( — ) indicates
a filler byte. The fields are indicated by the callouts in the right column of
Example 16–2.
Compaq COBOL for OpenVMS VAX would align the data as follows:
|||||1111 | 1111 |
| 1223 | 3444 | 4555 | 5555 | 5 | 6-77 | 88-- | 9999 | ---- | 0000 | 0000 | |
Compaq COBOL without the
-align
flag or the /ALIGNMENT qualifier or with
the /NOALIGNMENT qualifier would align the data as follows:
||||||1111 1111 |
| 1223 | 3444 | 4555 | 5555 | 5 | | 6-77 | 88-- | 9999 | ---- | 0000 | 0000 |
And finally, Compaq COBOL with the
-align
flag or the /ALIGNMENT qualifier
would align the data as follows:
||||||1111 1111 |
| 1-22 | 33-- | 4444 | ---- | 5555 | 5555 | 6-77 | 88-- | 9999 | ---- | 0000 | 0000 |
Managing Memory and Data Access 169