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

Count the number of Duplicate Records based on Multiple Keys


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Tue Feb 26, 2008 9:39 pm
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:

Use [URL] BBCode for External Links
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
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
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 Developer


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

PostPosted: Sun Sep 27, 2009 6:29 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top