>>-.---.-.---FP-ROUNDING--"dialect"----.-------->< +-/-+ +-NOFP-ROUNDING---------------+
dialect | COBOL370, ISO2002, ENTCOBOL, MVS, OS390, OSVS or VSC2 . |
Default: | NOFP-ROUNDING |
Phase: | Syntax check |
$SET: | Any |
If two data items are defined as follows:
05 numeric-field pic 999. 05 floating-field comp-1.
and the following statement is executed:
compute numeric-field floating-field = 7.7 + 1
specifying FP-ROUNDING"VSC2" or FP-ROUNDING"COBOL370" results in numeric-field containing 9 (rounded), whereas specifying NOFP-ROUNDING, FP-ROUNDING"ISO2002" or FP-ROUNDING"OSVS" would result in numeric-field containing 8 (truncated).
If, using the same two data items, the following statement is executed:
compute numeric-field = +7.6E0
specifying FP-ROUNDING"VSC2", FP-ROUNDING"COBOL370" or FP-ROUNDING"OSVS" results in numeric-field containing 8 (rounded), whereas specifying NOFP-ROUNDING or FP-ROUNDING"ISO2002" results in numeric-field containing 7 (truncated).
Comments:
FP-ROUNDING"ISO2002" is the equivalent of NOFP-ROUNDING.
With all possible values of dialect except ISO2002, if any of the sending data items of an arithmetic statement are floating-point, all receiving fields are rounded, regardless of the presence or absence of the ROUNDED phrase and regardless of whether or not the receiving fields are floating-point.
With all possible values of dialect except ISO2002 and OSVS, if any receiving data item is defined as floating-point, rounding takes place for all receiving data items regardless of the presence or absence of the ROUNDED phrase, of whether or not the receiving field is floating-point, and of whether or not there are any sending items which are floating-point.
With NOFP-ROUNDING or FP-ROUNDING"ISO2002", no rounding takes place for fixed-point targets in calculations involving floating-point operands unless the ROUNDED phrase is explicitly used in the source.