Syntax rules
If, after decimal point alignment, the number of places following the decimal point in the result of an arithmetic operation is greater than the number of decimal places provided in the resultant identifier, truncation is performed according to the size of this identifier.
If rounding is specified, the absolute value of the last significant digit of the resultant identifier is incremented by 1 if the most significant digit of those to be truncated is greater than or equal to 5.If rounding is not desired but truncation of excess digits is required, the last digit of the resultant identifier remains unchanged.
When the least significant digits of a resultant identifier are represented by P in the PICTURE character-string for that identifier, rounding or truncation takes place relative to the rightmost digit position for which internal storage is allocated (see Example 8-18).
ROUNDED is assumed for COMPUTATIONAL-1 or COMPUTATIONAL-2 result items, and need not be specified for them.
Example 8-18
Calculated result 1) | Description of result item | Description after rounding | Result without rounding |
03&2627 | PIC 99 | 03 | 03 |
123788&6 | PIC S999PPP | 124000 | 123000 |
1) & represents the operational decimal point.