I have the following scenario:
A particular column in the file has Packed Decimal values. I need to add the values in PD format, and finally convert into ZD format.
When i tried with the following format, it abended with S0C7.
TRAILER1= ('INPUT ST_SUPL_AMT : ',TOT=(97,4,PD,M2))
Later i found that the column also holds Null values ( in Packed format). The presence of Null values is probably the reason for the Abend.
The data what i have in the Input file is from the table. Hence it holds, null values as well.
The Null values can be identified by a character available in the 101th column.
This is how my Input file will look like: from 97 to 101 column.
97 98 99 100 101
Here the columns from 97 to 100 has a value(PDformat)
97 98 99 100 101
. . . . ?
Here the column 97-100 has null value(identified by ? in 101 column).
Kindly let me know how to sum the values from 97 - 100 in PD format, by rejecting the null values, so that i can avoid the abend. The final summed value in PD format, should later be converted to Zoned decimal format.
Thanks for the response!
But I am sorry to say that the change from M2 to M10 did not make any difference!
The field under purview is a S9(05)V9(02) comp-3 field. Hence, i need to take into account the signed value as well. I tried using M4 as well.
But, as i had mentioned in my query, the field has NULL values too. This is because the input file has the data downloaded from the DB2 table directly. So, while the function TOTAL gets executed, it encounters the NULL value (a non numeric PD field) and hence the data exception error (of S0C7).
So, while adding (or finding the total), i need to reject the rows which has these NULL values.
One another problem i face is, I have many such columns in the input file for which i need to find the sum. Hence, i cannot reject the row which has the NULL value while copying, because, one column might have a valid value and other a null value(in a row). If i reject that row, because of the presence of NULL(in the 2nd column) i will be rejecting the Proper value present in 1st column(and land up with a wrong SUM for the 1st column)
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
Please post some of the data in hex (to do this, browse the file and use "HEX ON"). Copy/paste some of the data into a reply here using the "Code" tag of the Reply panel.
Use Preview to make sure your post appears the way you want it to, then click Submit.
There is no NULL concept in packed decimal data. The data can be zero, positive, or negative, but there is no NULL. I suspect that your problem is with displacement (if the file actually contains packed-decimal data).
Is your file by chance variable? Did you account for the 4-bytes for the rdw?