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

Remove duplicates from a file after the Nth duplicate


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

New User


Joined: 21 Oct 2009
Posts: 2
Location: India

PostPosted: Wed Oct 21, 2009 9:00 pm
Reply with quote

Hi ,

I have a file as below :
AA
BB
BB
CC
CC
CC
CC

DD
DD
DD
DD

EE

If any record is duplicated more than three times I want to remove it.
The output file should be ( remove fouth occurence of CC and DD)
AA
BB
BB
CC
CC
CC
DD
DD
DD
EE
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Wed Oct 21, 2009 9:39 pm
Reply with quote

Hi,

You can try using the below JCL.


Code:
//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=input file
//OUT DD DSN=output file
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,2,CH) FIRST(3)
/*


It shud do the job I guess. icon_smile.gif

Thanks & Regards,
Back to top
View user's profile Send private message
Achutha

New User


Joined: 21 Oct 2009
Posts: 2
Location: India

PostPosted: Wed Oct 21, 2009 9:59 pm
Reply with quote

Hi Vasanth,

Thanks a lot.It is working.

Achutha
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top