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

Count of duplicate records in SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lanand_hps

New User


Joined: 05 Dec 2007
Posts: 82
Location: chennai

PostPosted: Thu Jul 17, 2008 9:16 pm
Reply with quote

Hi,
My requirement is to count the number of duplicates in the file and if there are duplicates i should set the jcl return code to 8.
I read how to put duplicate records in a file but how do i find the count and use it in jcl to set the return code?

Thanks in advance.
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: Thu Jul 17, 2008 9:29 pm
Reply with quote

Please show an example of the records in your input file (relevant fields only) for each case (dups, no dups) and what you expect for output and the return code. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields.
Back to top
View user's profile Send private message
lanand_hps

New User


Joined: 05 Dec 2007
Posts: 82
Location: chennai

PostPosted: Thu Jul 17, 2008 9:41 pm
Reply with quote

Hi Frank,
The LRECL is 250 and record format is FB.

The file will have a header record (first 3 character - 001), a footer (first 3 characters - 003) and the actual records will be in between (first 3 characters - 002)

This is my input file -

001 FILE-NAME
002 AAAA BAIND INDILIASDF 12345
002 BBBB BASD SDAFASFA 45678
002 BBBB ASDE ADFADSFF 5789
002 CCCC ASDF ERTERTRR 9878
003 END-OF-FILE

I need to sort this file to find out duplicates from 5th to 8 column.

Output :
001 FILE-NAME
002 AAAA BAIND INDILIASDF 12345
002 BBBB BASD SDAFASFA 45678
002 CCCC ASDF ERTERTRR 9878
003 END-OF-FILE

In the above example, there is one duplicate record with BBBB from 5th column. I need to check if there are duplicates. If the count is 0, i ll continue the processing. Otherwise, i need to set a return code of 8.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 17, 2008 11:15 pm
Reply with quote

lanand_hps,

The following DFSORT/ICETOOL JCl will give you the desired results. If there are any duplicate records step0200 will set a return code of 8.

Code:

//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IN       DD DSN=your input 250 byte file,
//            DISP=SHR                                   
//OUT1     DD DSN=Your output file without dups,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//OUT2     DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//TOOLIN   DD *                                           
  SELECT FROM(IN) TO(OUT1) ON(1,8,CH) NODUPS DISCARD(OUT2)
/*                                                       
//********************************************           
//STEP0200 EXEC PGM=IDCAMS                               
//SYSPRINT DD SYSOUT=*                                   
//DUPS     DD DSN=&&T1,DISP=SHR                           
//SYSIN    DD *                                           
  PRINT INFILE(DUPS) CHARACTER COUNT(1)                   
  IF LASTCC=0 THEN SET MAXCC=8                           
/*


Hope this helps...

Cheers
Back to top
View user's profile Send private message
lanand_hps

New User


Joined: 05 Dec 2007
Posts: 82
Location: chennai

PostPosted: Sun Jul 20, 2008 11:13 am
Reply with quote

Thanks ..
The forum and the members again and again prove that NOTHING IS IMPOSSIBLE...

thanks a lot!
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
Search our Forums:

Back to Top