In COBOL you are familiar with assumed decimal. When you expect a decimal in the input, then you need to declare the receiving field with the assumed decimal. So that decimal is displayed. The assumed decimal is also called the implied decimal.
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 the data. COBOL assumes that period or dot may come here. In sequential files, the data look like without a period.
In this case, when you DISPLAY the DECIMAL_VALUE, it shows as 1234567893399. The period is not visible in the DISPLAY output.

Dot
In the second case, hard coding of the dot in the data type declaration is the 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 copybooks or programs, you need to use implied decimals. For display or reporting purposes, you need to use a dot or period in the declaration.







You must be logged in to post a comment.