Field mapping in COBOL file and report



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Field mapping in COBOL file and report

Postby ajuatsgp » Wed Jun 16, 2010 5:11 pm

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
ajuatsgp
 
Posts: 82
Joined: Thu May 20, 2010 6:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Field mapping in COBOL file and report

Postby Robert Sample » Wed Jun 16, 2010 5:33 pm

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.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post