Ch 7_2. COMPUTING IN COBOL: Rounded Option


Rounded Option

  03 A1 PIC 99V999 VALUE 12.857.
  03 A2 PIC 99V999 VALUE 25.142.
  03 A3 PIC 99V99.

  ADD A1 A2 GIVING A3
  COMPUTE A3 = A1 + A2
What's the result of A3?

Desirable result would be 38.00.

How?

  ADD A1 A2 GIVING A3 ROUNDED
  COMPUTE A3 ROUNDED = A1 + A2
ROUNDED directly follows the resultant data name.