In COBOL, 01 and 77 entries are aligned on a full-word or double-word boundary, depending on the platform, vendor, and user-parmeter specifications.
Data inside 01 levels are not aligned unless specified by the programmer with the SYNC or SYNCHRONIZED clause in the data description. Generally, SYNC only applies to binary and floating-point (COMP-1 & COMP-2) data. Half-word (2-byte) data is aligned on a half-word boundary. Full-word (4-byte) and Double-word (8-byte) data is aligned on a full-word boundary.
Slack bytes are "filler" bytes inserted by the compiler to effect the alignment. Consider the following example:
Code:
01 GROUP-LEVEL.
05 3-BYTE-STRING PIC X(03).
05 FULL-WORD-BINARY PIC 9(09) COMP SYNC.
GROUP-LEVEL is aligned on a full- or double-word boundary. the next byte after 3-BYTE-STRING is the end of a full-word. So COBOL ignores that byte and starts FULL-WORD-BINARY at the following byte, the beginning of a full word.
So the effective code is as follows:
Code:
01 GROUP-LEVEL.
05 3-BYTE-STRING PIC X(03).
05 filler pic x(01). *> slack byte
05 FULL-WORD-BINARY PIC 9(09) COMP SYNC.
Note that GROUP-LEVEL is 8 bytes long. Without the SYNC it would have been 7 bytes long.
SYNC is not very useful any more. In the early days, the COBOL compiler would have to insert extra code to handle the mis-alignment of binary data. Most modern computers handle it in microcode.
It may still speed up the processing in extreme cases.