Duplicate removal and sum



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Duplicate removal and sum

Postby storage » Wed Dec 16, 2009 11:40 pm

Hello ,
I have an urgent requirement..I have the following data..

aaaa 11 2
bbb 44 3
aaa 22 4

I need to remove the duplicates and add the sum....
The output shld be as below
aaa 33 6
bbb 44 3
Can someone plse help...
storage
 
Posts: 28
Joined: Tue Nov 11, 2008 3:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Duplicate removal and sum

Postby dick scherrer » Thu Dec 17, 2009 1:12 am

Hello,

If this is truly urgent, you have hopefully started writing some code.

It is completely inappropriate to post "urgent requirements" on this forum. . .

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Duplicate removal and sum

Postby Frank Yaeger » Thu Dec 17, 2009 1:15 am

Since this is "urgent", you should have spent some more time giving the details of your requirement.

What is the RECFM and LRECL of your input file? What is the starting position, length and format of each field?

Assuming that the first field is in positions 1-3, the second field is in positions 9-10 and the third field is in position 14 (which I doubt is the case), you could use these DFSORT control statements:

   OPTION ZDPRINT
   SORT FIELDS=(1,3,CH,A)
   SUM FIELDS=(9,2,ZD,14,1,ZD)


If my assumptions are wrong, you need to give the correct information.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Duplicate removal and sum

Postby storage » Thu Dec 17, 2009 4:14 pm

Thanks Frank for a quick response...

I have few questions:
-->what is it which is removing the duplicate data?
Coz when I m running the job not all duplicate data is being removed.
-->Also many times I m getting S0c4 abend and when I do couple of reruns it works fine...there seems to be something which I m missing..
Please help..
storage
 
Posts: 28
Joined: Tue Nov 11, 2008 3:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Duplicate removal and sum

Postby storage » Thu Dec 17, 2009 4:17 pm

The below is the abend..
ICE185A 0 AN S0C7 ABEND WAS ISSUED BY DFSORT, ANOTHER PROGRAM OR AN EXIT (PHASE S 1)
storage
 
Posts: 28
Joined: Tue Nov 11, 2008 3:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Duplicate removal and sum

Postby storage » Thu Dec 17, 2009 4:52 pm

I understood that the sum parameter is removing dups..But it's not removing all dups for my dataset.
storage
 
Posts: 28
Joined: Tue Nov 11, 2008 3:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Duplicate removal and sum

Postby expat » Thu Dec 17, 2009 9:20 pm

Frank Yaeger wrote:Since this is "urgent", you should have spent some more time giving the details of your requirement.

Perhaps if you gave Frank the relevant information, a solution could be found faster.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: Duplicate removal and sum

Postby Frank Yaeger » Thu Dec 17, 2009 11:09 pm

Sigh.

The SUM statement keeps one record from each set of duplicates and adds the indicated fields from that set of duplicates.

An S0C7 is probably caused by using SUM for "bad" data. As I said, I assumed you had CH and ZD data in certain positions, but you probably don't. You need to tell me the layout of the records, that is, starting position, length and format of each field.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Duplicate removal and sum

Postby storage » Mon Dec 21, 2009 9:30 pm

Hello,
The below is the sample data :
It is to be sorted from 1-8 and the sum shld be frm 11-19 and 22-29

BATDEV    1888007    2771500
BATDEV    1429161    2771500


When I trying to use the program it's giving me S0C7..
storage
 
Posts: 28
Joined: Tue Nov 11, 2008 3:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Duplicate removal and sum

Postby Frank Yaeger » Mon Dec 21, 2009 11:19 pm

I don't know how you expect anyone to help you when you don't answer the questions asked and can't describe your requirement correctly.

Again: What is the RECFM and LRECL of your input file?

You say that the sum fields should be from 11-19 and 22-29, but in your example it looks like they are really at 11-17 and 22-28. Please give accurate positions for your fields that correspond to your example. If you don't use the correct positions in your control statements, then it's no surprise you'd get an S0C7.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post