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

Eliminate and retain duplicates


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

New User


Joined: 11 Jul 2008
Posts: 42
Location: USA

PostPosted: Thu Feb 18, 2010 12:58 am
Reply with quote

Was not able to find this one on the forum......

Requirement is to eliminate duplicates from an input file, and also store the duplicates in a different file.

1. Input file. LRECL = 528. Fixed block. LRECL = 27456.

Cols 1-15, 74-79 and 87-93 are the columns to be used to eliminate duplicates.


2. First Output file. LRECL = 528.Fixed block. LRECL = 27456

Order does not matter. File will have unique records.
When retaining the unique record, the first record amongst the duplicates can be retained, though it does not matter


3. Second Output file. LRECL = 528.Fixed block. LRECL = 27456

Order does not matter. File will have the duplicate records.

Example shown below-

1. Input file with following records- only data for the three columns shown below-

cols 1-15 cols 74-79 cols 87-93

111111111111111 aaaaaa uuuuuuu
111111111111111 aaaaaa uuuuuuu
111111111111111 aaaaaa uuuuuuu
222222222222222 aaaaaa uuuuuuu
333333333333333 aaaaaa uuuuuuu
111111111111111 bbbbbb sssssss
111111111111111 bbbbbb sssssss
444444444444444 bbbbbb ddddddd
--------------------------------------------------------------
2. First Output file with unique records will have following records-

111111111111111 aaaaaa uuuuuuu
222222222222222 aaaaaa uuuuuuu
333333333333333 aaaaaa uuuuuuu
111111111111111 bbbbbb sssssss
444444444444444 bbbbbb ddddddd

------------------------------------------------------------

3. Second Output file will show the duplicate records eliminated from the first Output file.

111111111111111 aaaaaa uuuuuuu
111111111111111 aaaaaa uuuuuuu
111111111111111 bbbbbb sssssss

So, number of records in input file = number of records in First Output file + number of records in Second Output file.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Feb 18, 2010 1:56 am
Reply with quote

Suresh Shankarakrishnan,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN       DD DSN=Your input file,DISP=SHR
//UNQ      DD SYSOUT=*                                         
//DUPS     DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
  SELECT FROM(IN) TO(UNQ) ON(1,15,CH) ON(74,6,CH) ON(87,7,CH) -
  FIRST DISCARD(DUPS)                     
//*
Back to top
View user's profile Send private message
Suresh Shankarakrishnan

New User


Joined: 11 Jul 2008
Posts: 42
Location: USA

PostPosted: Thu Feb 18, 2010 2:07 am
Reply with quote

Thanks Skolusu, it works . icon_smile.gif
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 How to remove block of duplicates DFSORT/ICETOOL 8
This topic is locked: you cannot edit posts or make replies. Compare files with duplicates in one ... DFSORT/ICETOOL 11
No new posts Merging 2 files but ignore duplicate... DFSORT/ICETOOL 1
No new posts COUNT the number of duplicates DFSORT/ICETOOL 3
This topic is locked: you cannot edit posts or make replies. SUM FIELDS=NONE in reverse - Get dupl... DFSORT/ICETOOL 9
Search our Forums:

Back to Top