Page 2 of 2

Re: Extract records by comparing files

PostPosted: Tue Jul 27, 2010 11:45 pm
by skolusu
MFsys,

It would have helped if you are clear with your requirements. Here is an updated DFSORT/ICETOOL JCL which will give you the desired results . I eliminated the duplicate records from file1 just based on the Dataset name.

//STEP0100 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//FB50     DD DSN=Your input1 FB 50 byte file,DISP=SHR
//TM96     DD DSN=&&TM96,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)   
//FB96     DD DSN=Your input2 FB 96 byte file,DISP=SHR
//         DD DSN=&&TM96,DISP=SHR,VOL=REF=*.TM96               
//OUT      DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
  SORT FROM(FB50) USING(CTL1)                                   
  SPLICE FROM(FB96) TO(OUT) ON(13,44,CH) WITH(1,3) USING(CTL2) 
//CTL1CNTL DD *                                                 
  SORT FIELDS=(6,44,CH,A),EQUALS                               
   SUM FIELDS=NONE                                             
  OUTFIL FNAMES=TM96,BUILD=(1,3,13:6,44,96:X)                   
//CTL2CNTL DD *                                                 
  OUTFIL FNAMES=OUT,                                           
  BUILD=(01,03,        $ FILE-1 FIELD-1                         
         3X,           $ 3 BLANKS                               
         13,44,        $ DATASET NAME                           
         3X,           $ 3 BLANKS                               
         04,06,        $ FILE-2 FIELD-1                         
         3X,           $ 3 BLANKS                               
         60,10,        $ FILE-2 FIELD-3                         
         3X,           $ 3 BLANKS                               
         73,10,        $ FILE-2 FIELD-4                         
         3X,           $ 3 BLANKS                               
         86,05,        $ FILE-2 FIELD-5                         
         4X,           $ 3 BLANKS                               
         95,02)        $ FILE-2 FIELD-6                         
//*

Re: Extract records by comparing files

PostPosted: Fri Jul 30, 2010 12:54 am
by MFsys
Thanks, skolusu. I checked your reply today only and have just tested it. It does produce the output the way I like it, thanks for that :). Though, there is still some more work which I would need to do due to some other aspects that I had overlooked earlier the solution you have provided would greatly help.