COBOL: Assumed Decimal Vs Dot

In COBOL you are familiar with assumed decimal.  When you expect decimal in the input, then you need to declare the receiving field with assumed decimal. So that decimal is displayed. The assumed decimal also called implied decimal.

Advertisements

Dot Vs Assumed Decimal

Assumed Decimal

Let us see an example:

01 DECIMAL_VALUE PIC 9(11) V 99

The above variable can handle data of 12345678933.99. The ‘V’ basically is not part of data. COBOL assumes that period or dot may come here. In sequential files, the data look like without period.

In this case, when you DISPLAY the DECIMAL_VALUE, it shows as 1234567893399 . Period is not visible in DISPLAY output.

COBOL: Assumed Decimal Vs Dot
COBOL: Assumed Decimal Vs Dot

Dot

In the second case, hard coding of dot in the data type declaration is only purpose to Display the value.

01 DECIMAL_VALUE PIC 9(11).99

The above declaration can handle the value 12345678933.99. When you give display for DECIMAL_VALUE, it shows as 12345678933.99. There is no change in DISPLAY.

The Bottom Line

In copy books or programs you need to use implied decimal. For display or reporting purpose you need to use dot or period in declaration.

Get new content delivered directly to your inbox.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.