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

Remove dups and summation


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Tue Mar 17, 2009 3:06 pm
Reply with quote

Hi,
My requirement is to remove duplicates and sum the values corresponding to the duplicates.
Say for ex:
Emp ID Sal
E001 1000
E002 2000
E001 1000
E001 1000
E002 2000
E003 3000

I should get the output as
Emp ID Sal
E001 3000
E002 4000
E003 3000
How can I get this done?

Thanks.
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Tue Mar 17, 2009 3:31 pm
Reply with quote

Hi,

Try below one

Code:

SORT FIELDS=(1,4,CH,A)
SUM FIELDS=(6,4,ZD)
END


Regards
R KARTHIK
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Mar 17, 2009 4:17 pm
Reply with quote

Hi,
To remove duplicates
adding a small change to the previous post
Code:

SUM FIELDS=(6,4,ZD) ,XSUM

and declare the XSUM in the DD name
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Mar 17, 2009 4:39 pm
Reply with quote

Anand,

The card provided by Karthik looks ok. I don't think the OP was asking for an 'XSUM'.
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Mar 17, 2009 4:53 pm
Reply with quote

Arun,
OP was saying Remove dups and summation so it needs to be there to have the duplicates in a seperate file
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Mar 17, 2009 5:06 pm
Reply with quote

Hi,

If you look at the input/output shown by OP - you'll find that sort-card from KARTHIK should suffice.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Mar 17, 2009 5:09 pm
Reply with quote

Anand,

The OP never mentioned about extracting the duplicates in a "separate file". Duplicate records automatically get removed during summation and that's what I understood. May be I am missing something here. We can wait for his response.
Back to top
View user's profile Send private message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Wed Mar 18, 2009 11:33 am
Reply with quote

Thanks all,

Karthik's reponse has solved my issue. I do not want duplicates in a separate file.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Remove leading zeroes SYNCSORT 4
No new posts How to remove block of duplicates DFSORT/ICETOOL 8
No new posts To Remove spaces (which is in hex for... JCL & VSAM 10
No new posts How to remove spaces in between. SYNCSORT 12
Search our Forums:

Back to Top