Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us