Parthi
Parthi

Reputation: 135

How to print decimal points in cobol?

I want the data to be in decimal format in the spool. How can I print the data with decimal points. I have used

Pic 99v99

for my data-definition, but it is not showing a decimal-point in the result when I DISPLAY it.

12.34 for the value of my data is displayed as 1234

Upvotes: 6

Views: 6086

Answers (1)

piet.t
piet.t

Reputation: 11911

The V in 99V99 is just an "invisible" decimal-point that sets the correct alignment for any fixed-point-operations. It has the advantage that it doesn't take up any additional memory. If you want a comma that is displayed use a PIC-clause like 99.99 which will

  • take up one more byte
  • only work with USAGE DISPLAY, not on COMP-fields

Note: When using DECIMAL-POINT IS COMMA you have to change the PIC-clause accordingly to: PIC 99,99

Upvotes: 6

Related Questions