COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
alignment considerations cause the compiler to allocate unused bytes between data items. These
bytes are called implicit FILLER bytes (see Implicit FILLER Bytes).
Data Alignment in Receiving Items
Not all data storage locations in a COBOL program are the same size. When you direct a COBOL
program to store a value of a given size at a location of a different size, the process extends or
truncates the value according to alignment rules:
Standard Alignment RuleCategory of Receiving Item
If the receiving data item is numeric, data is aligned by decimal point and zero-filled
or truncated on either end of each value, as required. When you do not specify a
Numeric
decimal point in the data item’s description, the decimal point is assumed to be
immediately after the rightmost character position.
If the receiving item is numeric edited, data is aligned by decimal point and zero-filled
or truncated on either end of each value, as required, except where editing would
replace leading zeros.
Numeric Edited
If the receiving data item is alphanumeric, alphanumeric edited, alphabetic, or national,
data is aligned at the leftmost character position and space-filled or truncated to the
right of each value, as required.
Alphanumeric
Alphanumeric Edited
Alphabetic
National
Standard data representation and alignment rules are not always appropriate, so these clauses
and directive exist to override them:
EffectClause or Directive
Right-justifies an alphanumeric data within a receiving data item (see JUSTIFIED Clause
(page 218))
JUSTIFIED clause
Aligns an elementary data item on the most natural computer storage boundary (see
SYNCHRONIZED Clause (page 217))
SYNCHRONIZED clause
Aligns BINARY/COMPUTATIONAL data items on byte boundaries unless the
SYNCHRONIZED clause applies to them, in which case standard alignment rules apply
(see PORT and NOPORT (page 560))
PORT directive
Data Alignment in Memory
How a data item is aligned in memory is determined by:
• Its USAGE clause
• Whether its description includes the SYNCHRONIZED clause
• Whether the program is compiled with the PORT directive
• The machine on which the program executes
For efficiency, a data item that is described as USAGE BINARY or USAGE COMPUTATIONAL is
aligned on a 2-byte boundary.
To improve the alignment of its subordinate items, a level-01 (record) or level-77 data item is
aligned on an 8-byte boundary.
For TNS processes, a word is 2 bytes (16 bits), so a data item that is aligned on a word boundary
is aligned on a byte position that is divisible by 2. For TNS/E processes, a word is 4 bytes (32
bits), so a data item that is aligned on a word boundary is aligned on a byte position that is
divisible by 4.
Data Alignment in Receiving Items 87










