SYNCHRONIZED clause
The SYNCHRONIZED clause specifies the alignment of an elementary item on a natural boundary in storage.
SYNC is an abbreviation for SYNCHRONIZED and has the same meaning.
The SYNCHRONIZED clause is never required, but can improve performance on some systems for binary items used in arithmetic.
The SYNCHRONIZED clause can be specified for elementary items and for level-01 group items, in which case every elementary item within the group item is synchronized.
- LEFT
- Specifies that the elementary item is to be positioned so that it will begin at the left character position of the natural boundary in which the elementary item is placed.
- RIGHT
- Specifies that the elementary item is to be positioned such that it will terminate on the right character position of the natural boundary in which it has been placed.
When specified, the LEFT and the RIGHT phrases are syntax checked but have no effect on the execution of the program.
The length of an elementary item is not affected by the SYNCHRONIZED clause.
The following table lists the effect of the SYNCHRONIZE clause on other language elements.
Language element | Comments |
---|---|
OCCURS clause | When specified for an item within the scope of an OCCURS clause, each occurrence of the item is synchronized. |
USAGE DISPLAY or PACKED-DECIMAL | Each item is syntax checked, but the SYNCHRONIZED clause has no effect on execution. |
USAGE NATIONAL | Each item is syntax checked, but the SYNCHRONIZED clause has no effect on execution. |
USAGE BINARY or COMPUTATIONAL | When the item is the first elementary item subordinate
to an item that contains a REDEFINES clause, the item must not require
the addition of unused character positions. When the synchronized clause is not specified for a subordinate data item (one with a level number of 02 through 49):
When SYNCHRONIZED is not specified for binary items, no space is reserved for slack bytes. |
USAGE POINTER, PROCEDURE-POINTER, FUNCTION-POINTER, OBJECT REFERENCE, INDEX | The data is aligned on a fullword boundary when the LP(32) compiler option is in
effect. The data is aligned on a doubleword boundary when the LP(64) compiler option is in effect. |
USAGE COMPUTATIONAL-1 | The data is aligned on a fullword boundary. |
USAGE COMPUTATIONAL-2 | The data is aligned on a doubleword boundary. |
USAGE COMPUTATIONAL-3 | The data is treated the same as the SYNCHRONIZED clause for a PACKED-DECIMAL item. |
USAGE COMPUTATIONAL-4 | The data is treated the same as the SYNCHRONIZED clause for a COMPUTATIONAL item. |
USAGE COMPUTATIONAL-5 | The data is treated the same as the SYNCHRONIZED clause for a COMPUTATIONAL item. |
USAGE UTF-8 | Each item is syntax checked, but the SYNCHRONIZED clause has no effect on execution. |
DBCS and external floating-point items | Each item is syntax checked, but the SYNCHRONIZED clause has no effect on execution. |
REDEFINES clause | For an item that contains a REDEFINES clause,
the data item that is redefined must have the proper boundary alignment
for the data item that redefines it. For example, if you write the
following, be sure that data item A begins on a fullword boundary:
|
In the FILE SECTION, the compiler assumes that all level-01 records that contain SYNCHRONIZED items are aligned on doubleword boundaries in the buffer. You must provide the necessary slack bytes between records to ensure alignment when there are multiple records in a block.
In the WORKING-STORAGE SECTION, the compiler aligns all level-01 entries on a doubleword boundary.
For the purposes of aligning binary items in the LINKAGE SECTION, all level-01 items are assumed to begin on doubleword boundaries. Therefore, if you issue a CALL statement, such operands of any USING phrase within it must be aligned correspondingly.