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

Compare two files and remove duplicates


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Shivendu

New User


Joined: 20 Feb 2009
Posts: 14
Location: Workstation

PostPosted: Mon Apr 06, 2009 4:54 pm
Reply with quote

Quick help needed...
Code:
//TOOLIN DD *                                           
COPY FROM(IN1) TO(T1) USING(CTL1)                       
COPY FROM(IN2) TO(T1) USING(CTL2)                       
SELECT FROM(T1) TO(OUT) ON(1,13,CH) NODUPS USING(CTL3)
/*                                                     
//CTL1CNTL DD *                                         
  INREC OVERLAY=(3519:C'1')                             
/*                                                     
//CTL2CNTL DD *                                         
  INREC OVERLAY=(3519:C'2')                             
/*                                                     
//CTL3CNTL DD *                                         
  OUTFIL FNAMES=OUT,INCLUDE=(3519,1,CH,EQ,C'2'),       
    BUILD=(1,3518)                                     
/*                                                     


IN1

Code:
1001789877AQ1   1



IN2
Code:
1001789794AQ1   1
1001789877AQ1   1
1001910140AQ1   1
1001910140AQ1   2


OUTPUT i m gettng is
Code:
1001789794AQ1   1


But I want (whatever is in IN2 but not in IN1)
Code:
1001789794AQ1   1
1001910140AQ1   1
1001910140AQ1   2



[/code][/quote]
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 5:13 pm
Reply with quote

Plz customize and use the below code...


Code:
//STEP001  EXEC  PGM=ICETOOL                               
//TOOLMSG  DD    SYSOUT=*                                   
//SSMSG    DD    SYSOUT=*                                   
//FILEA    DD    DSN=DGCVPG2.V831.LISTDSN.FILTER2,DISP=SHR 
//FILEB    DD    DSN=DGCVPG2.V831.LISTDSN.FILTER4,DISP=SHR 
//FILEC    DD    DSN=DGCVPG2.REGION.DELTA,DISP=SHR         
//T1       DD    DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(15,15)),   
//     DISP=(MOD,PASS)                                     
//TOOLIN DD *                                               
COPY FROM(FILEB) TO(T1) USING(CTL1)                         
COPY FROM(FILEA) TO(T1) USING(CTL2)                         
SELECT FROM(T1) TO(FILEC) ON(1,40,CH) NODUPS USING(CTL3)   
/*                                                         
//CTL1CNTL DD *                                             
  INREC OVERLAY=(65:C'B')                                   
/*                                                         
//CTL2CNTL DD *                                             
  INREC OVERLAY=(65:C'A')                                   
/*                                                         
//CTL3CNTL DD *                                   
  OUTFIL FNAMES=FILEC,INCLUDE=(65,1,CH,EQ,C'B'),   
    BUILD=(1,64)                                   
/*     
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 5:14 pm
Reply with quote

IN1 is fileA
IN2 is FileB
FileC is Delta file....
Back to top
View user's profile Send private message
Shivendu

New User


Joined: 20 Feb 2009
Posts: 14
Location: Workstation

PostPosted: Mon Apr 06, 2009 5:26 pm
Reply with quote

Did the same ....problem is whatever is duplicate (1-13 bytes) in IN2 (though not present in IN1) is not getting writen in output.
Back to top
View user's profile Send private message
himanshu7

Active User


Joined: 28 Aug 2007
Posts: 131
Location: At Desk

PostPosted: Mon Apr 06, 2009 6:15 pm
Reply with quote

Hi Shivendu
Quote:

Did the same ....problem is whatever is duplicate (1-13 bytes) in IN2 (though not present in IN1) is not getting writen in output.



The above code is tested in my system and working fine.
Back to top
View user's profile Send private message
Shivendu

New User


Joined: 20 Feb 2009
Posts: 14
Location: Workstation

PostPosted: Mon Apr 06, 2009 6:35 pm
Reply with quote

Thanks all....it is done icon_smile.gif
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Mon Apr 06, 2009 9:21 pm
Reply with quote

Shivendu wrote:
Need to compare data in two files FILE1 and FILE2. Data which is present ONLY in FILE2 should be written to a new file FILE3 (i.e removing duplicates)

Coding a simple SyncSort JOIN application will also produce the desired results. For example:
Code:
//STEP1  EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTJNF1 DD DSN=FILE1,... 
//SORTJNF2 DD DSN=FILE2,...   
//SORTOUT  DD DSN=FILE3,... 
//SYSIN    DD *
  JOINKEYS FILES=F1,FIELDS=(1,3,A) 
  JOINKEYS FILES=F2,FIELDS=(1,3,A) 
  JOIN UNPAIRED,F2,ONLY 
  SORT FIELDS=(1,13,CH,A)
  DUPKEYS FIELDS=NONE 
/*
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Apr 07, 2009 11:04 am
Reply with quote

Quote:
It's a bit urgent.

Urgent for you maybe.
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 -> JCL & VSAM Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top