Page 1 of 1

Field mapping in COBOL file and report

PostPosted: Wed Jun 16, 2010 5:11 pm
by ajuatsgp
Hi,
I have a field defined as PIC9(17).
I need to show this field in a report as 9(9).9(2),the above field basically refers to an amount fied.
How to do that???if anybody knows any ways of doing it using Vision Plus routine that is more prefarably using normal Cobol is also fine
I have another amount field in a file of x(21) I need to send this field to my field in a file as9(9).9(3).How to do that???

Please reply asap

Re: Field mapping in COBOL file and report

PostPosted: Wed Jun 16, 2010 5:33 pm
by Robert Sample
You can use COMPUTE or MOVE to move a PIC 9(17) variable to any numeric field, even one defined 9(9).9(2). The first 8 digits of the 17-digit variable will not appear on the report, and the two digits after the decimal point will be zeroes.

You can MOVE a PIC X(21) variable to a PIC 9(9).9(3) variable. The decimal point is implied after the 21st character so the three digits after the decimal point will all be zeroes. The first twelve characters will not be moved. And if you have non-numeric data in the last 9 characters you may cause a S0C7 abend depending upon what you do with the receiving variable.

Both of these cases are quite thoroughly explained in the COBOL Language Reference manual. I recommend you get a copy and keep it handy.