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??? 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???
-----------------
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.
----------
Hi
I have already tried the above things as described by you.
when i am tryig to move a 9(17) field to a 9(9).9(2), there will be preceding zeroes and also if I am using cobol editing field types such as z(9).9(2) to supress the leading zeroes my problem is not getting resolved.
Basically the file I am using is so defined that it has a predetermined NOD of 2, I mean if I enter 1000 in the amount field then it will treat it as 10.00 for all of its processing however if we will see the file it will show 1000 only.
So now when I am moving this fied of mine to report variable I am getting 1000.00 but it should show 10.00.
And for the second case I have a field define with X(21) with edit pattern as ZZZZZZZZZ,ZZZ,ZZZ.99 when i am trying to move this field to 9(9).9(3), i am getting SOC7 probably due to the commas.