FP-ROUNDING

Syntax:

 >>-.---.-.----.--FP-ROUNDING--"dialect"-------------><  
    +-/-+ +-NO-+

Parameters:

dialect COB370, ENTCOBOL, MVS, OS390, OSVS or VSC2 .

Properties:

Default: NOFP-ROUNDING (Dialect)
Phase: Syntax check
$SET: Any

Comments:

With all possible values of dialect, 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 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, no rounding takes place for fixed-point targets in calculations involving floating-point operands unless the ROUNDED phrase is explicitly used in the source.

Example:

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"COB370" results in numeric-field containing 9 (rounded), whereas specifying NOFP-ROUNDING 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"COB370" or FP-ROUNDING"OSVS" results in numeric-field containing 8 (rounded), whereas specifying NOFP-ROUNDING results in numeric-field containing 7 (truncated).