Real Decimal Point-Data Type Example


Scenario - Below example describes about the real decimal point data type declaration and usage in COBOL programming.

Code -

----+----1----+----2----+----3----+----4----+----5----+
       IDENTIFICATION DIVISION.
       PROGRAM-ID. ADECPDT.
       AUTHOR. MTH.

       DATA DIVISION. 
       WORKING-STORAGE SECTION.
       01 WS-VARS.
          05 WS-REAL-DP             PIC 9(03).9(2). 

       PROCEDURE DIVISION.

           MOVE 123.45              TO  WS-REAL-DP.

           DISPLAY "DISLAY FOR 9(03).9(2):  " WS-REAL-DP.

           STOP RUN. 

Output -

DISLAY FOR 9(03).9(2):  123.45 

Explaining example -

In the above example:

  • The real decimal variable WS-REAL-DP displays the value with a decimal point.