Joined: 22 Aug 2005
I faced a small problem in my code in COBOL.
I read a variable (PIC 9(03)V99) from a file record. In file, the value for this variable is 00450. Now, i wish to print this value in a report with a decimal point shown.
So, I moved this variable to another display variable with declaration
Now, I was expecting that, in the report, it should show the value as 004.50
But after execution, the value was getting printed as 000.04
If I change my variable declaration (in the copybook of the input file) as
9(05), instead of 9(03)V99, then the value is getting correctly displayed as 004.50
Could anybody please expalin why this is happening? As per my knowledge, moving of 9(03)V99 to 9(03).99 should work straight away and should diaplay the correct output. I dont understand why it is failing in this particular case.