Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To Find the "Total" of Selected Records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: To Find the "Total" of Selected Records
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    Post subject: Re: To Find the "Total" of Selected Records using
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    Post subject:
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

Site Director


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

PostPosted: Thu Jul 10, 2008 8:22 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 3 Sat May 06, 2017 12:59 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us