IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To Find the "Total" of Selected Records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Anand Syril

New User


Joined: 28 Dec 2005
Posts: 13

PostPosted: Thu Jul 10, 2008 12:26 pm
Reply with quote

Hi,

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.
SORT FIELDS=COPY
OUTFIL NODETAIL,REMOVECC,
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.
Back to top
View user's profile Send private message
Vasukip
Currently Banned

New User


Joined: 17 Jun 2008
Posts: 48
Location: Chennai

PostPosted: Thu Jul 10, 2008 12:47 pm
Reply with quote

Hi,

Here instead of M2 you can give M10 like the below

Code:

SORT FIELDS=COPY
OUTFIL NODETAIL,REMOVECC,
TRAILER1= ('INPUT ST_SUPL_AMT : ',TOT=(97,4,PD,M10))
Back to top
View user's profile Send private message
Anand Syril

New User


Joined: 28 Dec 2005
Posts: 13

PostPosted: Thu Jul 10, 2008 1:23 pm
Reply with quote

Hi Vaas,

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)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 10, 2008 8:22 pm
Reply with quote

Hello,

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?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 10, 2008 9:07 pm
Reply with quote

Anand Syril,

Use the following DFSORT control cards

Code:

//SYSIN    DD *                                     
  SORT FIELDS=COPY                                   
  OUTREC IFTHEN=(WHEN=(101,1,CH,EQ,C'?'),           
        OVERLAY=(97:+0,TO=PD,LENGTH=4))             
  OUTFIL NODETAIL,REMOVECC,                         
  TRAILER1=('INPUT ST_SUPL_AMT : ',TOT=(97,4,PD,M10))
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top