The SYNCHRONIZED clause specifies elementary item alignment on word boundaries of the computer's memory.
General Format
{SYNCHRONIZED} [LEFT ]
{SYNC } [RIGHT]
Syntax Rules
- SYNC is an abbreviation of SYNCHRONIZED.
- The SYNCHRONIZED clause can be used for elementary items only.
- A SYNCHRONIZED clause may not be used with an external floating-point data item.
General Rules
- The SYNCHRONIZED clause is used to specify that word boundary alignment should be performed for the data item. Normally, data
contained in records is aligned on byte boundaries. Only data items whose underlying representation is binary are affected
by the SYNCHRONIZED clause.
- The SYNCHRONIZED clause causes the data item to be placed on a boundary that is an even multiple of the natural size of the
data item. The following table lists the boundary used for each size of data item:
Data Size
|
Boundary Multiple
|
1-2
|
2
|
3-4
|
4
|
5-8
|
8
|
- A group item that contains a synchronized data item is also synchronized on the same boundary. Regardless of the effects of
synchronization, a group item always begins at the same location as its first elementary data item.
- Synchronization may result in the creation of filler bytes. These bytes count in the size of any group item that contains
them. For this reason, a group item that contains synchronized data may be larger than the total size of its elementary items.
- Level 01 and level 77 data items that are not otherwise synchronized are placed on a boundary that can be selected at compile
time. By default, these items are placed at word boundaries that are divisible by two.
- Level 01 and level 77 data items that are POINTER or COMP-5 items are automatically synchronized to an appropriate machine
boundary, regardless of any compile-time settings. All C-style data types are automatically synchronized regardless of their
level. This allows you to pass these items safely to C subroutines without having to concern yourself with alignment.
- A compile-time (-Dl) option can be used to cut back the maximum boundary multiple. For example,
-Dl4 would cause items of size 1 or 2 to be synchronized on 2-byte boundaries, and all other items synchronized on 4-byte boundaries.
If this option is not specified, then the maximum boundary multiple depends on the compatibility mode being used:
Mode
|
Boundary Limit
|
VAX COBOL
|
8
|
RM/COBOL
|
2
|
ICOBOL
|
1
|
A limit of 1 effectively inhibits synchronization.
- The LEFT and RIGHT options are treated as commentary. They have the same effect as a SYNCHRONIZED clause without either option.