COBOL Manual for TNS and TNS/R Programs

Data Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
7-86
SYNCHRONIZED Clause
SYNCHRONIZED Clause
The SYNCHRONIZED clause forces alignment of an elementary item on the most
natural computer storage boundary. The elementary item cannot be a pointer or a
national data item.
Efficiency improves if data is aligned on natural computer memory boundaries,
because additional object code is sometimes required to store or retrieve data when 2
bytes of the same word belong to different data items. Also, when a data item is stored
within 2-byte boundaries, the complexity of code to process it can decrease.
The SYNCHRONIZED clause is usually unnecessary, because the automatic
alignment is also the most natural: each level-77 item of the Working-Storage Section
and Extended-Storage Section and each level-01 item is aligned on a physical 2-byte
boundary. (A TNS word is 16 bits and a TNS/R word is 32 bits.)
Both automatic and forced alignment can cause the compiler to generate implicit
FILLER data.
Example 7-18. Variable-Size Table
01 ACTIVITY-TABLE-RECORD.
03 ACTIVITY-COUNT PICTURE 99.
03 ACTIVITY-TABLE OCCURS 10 TO 20 TIMES
DEPENDING ON ACTIVITY-COUNT
INDEXED BY SAVE-INX-1
SAVE-INX-2.
05 ACTIVITY-ENTRY PICTURE 999.
Example 7-19. Fixed-Size Table as an Element of a Variable-Size Table
01 DISPOSAL-COMPANIES.
03 H-COUNT PICTURE 99.
03 HAULER OCCURS 1 TO 12 TIMES DEPENDING ON H-COUNT.
05 VEHICLE OCCURS 15 TIMES.
07 V-NUMBER PICTURE 9(5).
07 CAPACITY-CU-FT PICTURE 9(4).
07 SERVICE-SCHEDULE PIC X.
...
SYNCHRONIZED
SYNC LEFT
RIGHT
VST101.vsd