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

Remove Duplicates and ....


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

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Fri Jul 31, 2009 8:12 pm
Reply with quote

I have a small requirement:

File1:
Length = 9



File2:

Length = 127
Field1|Field2|Field3|.....
Field2 starts from position 14 (which is same as in File1)


Requirement is:

1) To remove the duplicates in File 1
2) To retrieve the records into a new file File3 from File2
where Field2 in File2 = File1

Regards,
Kranthi.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Fri Jul 31, 2009 8:17 pm
Reply with quote

Below are the examples for the above requirement!

File1:

36186CAN3
31566BAN3
36186CAN3
31566BAN3

File2:


0121708DLMS1¦36186CAN3¦50020908¦12285664¦S¦840
0121708DLNR1¦36186CAN3¦50020908¦12285664¦S¦840
0121708OXG91¦36186CAN3¦50020908¦12285664¦S¦840
0123704OXG91¦01F062432¦70305073¦01021898¦S¦840
031070H31BF1¦31412MHF8¦70305065¦10346548¦B¦840


File2 may contain the duplicates. For every record in File1, I need all records in File2.

Output looks like:



0121708DLMS1¦36186CAN3¦50020908¦12285664¦S¦840
0121708DLNR1¦36186CAN3¦50020908¦12285664¦S¦840
0121708OXG91¦36186CAN3¦50020908¦12285664¦S¦840
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Jul 31, 2009 9:56 pm
Reply with quote

mkk157,

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

Code:

//STEP0100 EXEC PGM=ICETOOL         
//TOOLMSG  DD SYSOUT=*             
//DFSMSG   DD SYSOUT=*             
//I1       DD DSN=your input 9 byte file,DISP=SHR
//I2       DD DSN=your input 127 byte file,DISP=SHR
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)       
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                     
  SORT FROM(I1) USING(CTL1)                                         
  COPY FROM(I2) USING(CTL2)                                         
  SORT FROM(T1) USING(CTL3)                                         
//CTL1CNTL DD *                                                     
  SORT FIELDS=(1,9,CH,A)                                             
  SUM FIELDS=NONE                                                   
  OUTFIL FNAMES=T1,BUILD=(14:1,9,128:C'$')                           
//CTL2CNTL DD *                                                     
  OUTFIL FNAMES=T1,OVERLAY=(128:X)                                   
//CTL3CNTL DD *                                                     
  SORT FIELDS=(14,9,CH,A),EQUALS                                     
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(129:SEQNUM,8,ZD,RESTART=(14,9))),
  IFTHEN=(WHEN=GROUP,BEGIN=(129,8,ZD,EQ,1),PUSH=(128:128,1))         
  OUTFIL FNAMES=OUT,BUILD=(1,127),                                   
  INCLUDE=(128,1,CH,EQ,C'$',AND,129,8,ZD,GT,1)                       
//*
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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Remove leading zeroes SYNCSORT 4
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 To Remove spaces (which is in hex for... JCL & VSAM 10
Search our Forums:

Back to Top