The TRUNC Compiler directive can change the results of some operations, as demonstrated in the following examples in which
item A is described as PIC 99 COMP.
|MOVE 163 TO A
|MOVE 263 TO A
|MOVE 13 TO A, ADD 150 TO A
|MOVE 13 TO A, ADD 250 TO A
- This directive has no effect on the truncation of low-order digits in non-integer data. This always conforms with the behavior
specified in ANSI COBOL.
- If the IBMCOMP Compiler directive is set, extra upper bytes may be allocated to a COMP item. These are counted in the space
allocated. When IBMCOMP is on, padding bytes may be generated before a COMP item with a SYNC clause; these are not part of
the item, and are never affected by data stored in the item.
- When a value being stored into a signed item is limited to the number of digits by the PICTURE clause, it can never be big
enough to overwrite the sign bit. When the NOTRUNC directive is set this is not true, and the value, if large enough, overwrites
the sign bit.