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 of duplicate records in SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Count of duplicate records in SORT
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 Moderator


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

PostPosted: Thu Jul 17, 2008 9:29 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Count of duplicate records in SORT
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    Post subject:
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    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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm


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