COBOL real answer on assumed decimal vs dot

In COBOL you are so familiar with assumed decimal that you will give in data type to handle decimal values. When the data in the input file comes as decimal, to handle it in the program, you will declare with ‘V’. The assumed decimal also called implied 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, it is to understand by COBOL that period or dot may come here. Internally, you cannot find any difference how data is written in sequential file.

In this case, when you give Display for DECIMAL_VALUE, it will show as 1234567893399 -There will not be any dot.

Differences

In the second case, hard coding of dot in the data type declaration is mainly for the purpose of Display.

01 DECIMAL_VALUE PIC 9(11).99

In the above case, the above declaration can handle the value 12345678933.99. When you give display for DECIMAL_VALUE, it will show as 12345678933.99 -No change in the display.

The conclusion is in copy books or program you can give only implied decimal. Only for display or reporting purpose you can declare with dot or period.

Advertisements

Author: Srini

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