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
 

 

Count the number of Duplicate Records based on Multiple Keys

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Prasanya

New User


Joined: 04 Jun 2007
Posts: 34
Location: Chennai

PostPosted: Tue Feb 26, 2008 3:50 pm    Post subject: Count the number of Duplicate Records based on Multiple Keys
Reply with quote

Hi,
I have a job in which I need to Sort & count the number of times a certain combination occurs in the input file & write the count to the O/P.
The Input will look like this:
Excp-code Brand
13.11.10 abc
12.12.10 def
11.13.10 def
11.13.10 ghi
11.13.10 ghi

The Exception Code is at 1:10,CH & the Brand is at 24:3,CH

I need the Count to be taken on a unique combination of Excp-Code & Brand, & I need the O/P to be in a formatted manner like this:
Excp-code Brand Count
11.13.10 ghi 2
11.13.10 def 1
12.12.10 def 1
13.11.10 abc 1

It is possible by using the SORT Utility. Actually, there is already a job similar to this requirement specified here(http://ibmmainframes.com/about28482.html), posted by Frank Yaeger. I just need to modify the Control Cards to include the second parameter for Sort function, as well as display it.

Can someone help me with this please?
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Feb 26, 2008 9:39 pm    Post subject:
Reply with quote

Actually, your requirement is simpler than that other one. You can use a DFSORT/ICETOOL job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL                                         
//TOOLMSG DD SYSOUT=*                                             
//DFSMSG  DD SYSOUT=*                                             
//IN DD *                                                         
13.11.10               abc                                       
12.12.10               def                                       
11.13.10               def                                       
11.13.10               ghi                                       
11.13.10               ghi                                       
/*
//OUT DD SYSOUT=*                                                 
//TOOLIN DD *                                                     
OCCUR FROM(IN) LIST(OUT) ON(1,10,CH) ON(24,3,CH) ON(VALCNT) -     
  NOHEADER BLANK                                                 
/*


OUT will have:

Code:

11.13.10     def                 1     
11.13.10     ghi                 2     
12.12.10     def                 1     
13.11.10     abc                 1     


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
Prasanya

New User


Joined: 04 Jun 2007
Posts: 34
Location: Chennai

PostPosted: Wed Feb 27, 2008 9:32 am    Post subject: Reply to: Count the number of Duplicate Records based on Mul
Reply with quote

Thanks a Million Frank. The Job Works perfectly now. icon_biggrin.gif
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Fri Sep 25, 2009 7:38 pm    Post subject: Reply to: Count the number of Duplicate Records based on Mul
Reply with quote

I have another requirement similar to this.

Instead of two key fields I have 9 key fields for which I need to find a count.

Can you please advise if that is possible.

Thanks,
Dharani
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sun Sep 27, 2009 6:29 am    Post subject:
Reply with quote

Show an example of the records in your input file and what you expect for output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of each relevant field.
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 Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
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 Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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