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
 

 

Remove dups and summation

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 51

PostPosted: Tue Mar 17, 2009 3:06 pm    Post subject: Remove dups and summation
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    Post subject: Reply to: Remove dups and summation
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    Post subject: Reply to: Remove dups and summation
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: 2276
Location: @my desk

PostPosted: Tue Mar 17, 2009 4:39 pm    Post subject:
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    Post subject: Reply to: Remove dups and summation
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

Senior Member


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

PostPosted: Tue Mar 17, 2009 5:06 pm    Post subject:
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: 2276
Location: @my desk

PostPosted: Tue Mar 17, 2009 5:09 pm    Post subject:
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: 51

PostPosted: Wed Mar 18, 2009 11:33 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts Remove junk values in a file and rite... KP1125 DFSORT/ICETOOL 2 Wed Jan 25, 2017 9:58 pm
No new posts Sort Card to Remove Duplicate records... raj4neo SYNCSORT 2 Wed Jan 25, 2017 4:44 am
No new posts Remove Special Characters from Mainfr... Rodger Zhang All Other Mainframe Topics 6 Wed Jul 06, 2016 1:12 am
No new posts Remove header only knobi SYNCSORT 5 Mon Feb 15, 2016 10:42 pm


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