Page 1 of 1

Comparing 2 different length file and creating 2 other files

PostPosted: Mon Mar 21, 2011 7:36 pm
by averagebob
Hello,
I am trying to compare 2 different length files in Syncsort and output 2 files; one matched the other unmatched which would be in the same format as the 2nd file.
File A is a 382 byte record with the key in cc 162 -177. I am comparing the key in file B, which is 220 byes and the key is in cc 1 - cc16. If there is a match found; I want to move the 220 byte from file B to file C and if the record is unmatched; I want to move the record from file B to File D. Thank you for your help! -Bob

Re: Comparing 2 different length file and creating 2 other f

PostPosted: Tue Mar 22, 2011 10:18 pm
by Alissa Margulies
Try this SyncSort JOIN step:
//SORT1  EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                   
//SORTJNF1 DD DSN=FILEA,DISP=...                         
//SORTJNF2 DD DSN=FILEB,DISP=...                         
//SORTOF01 DD DSN=FILEC,DISP=...                         
//SORTOF02 DD DSN=FILED,DISP=...                         
//SYSIN    DD *                                         
   JOINKEYS FILES=F1,FIELDS=(162,16,A)                     
   JOINKEYS FILES=F2,FIELDS=(1,16,A)                     
   JOIN UNPAIRED,F2                                     
   REFORMAT FIELDS=(F1:1,1,F2:1,220)                     
   SORT FIELDS=COPY                                     
   OUTFIL FILES=01,INCLUDE=(1,1,CH,EQ,C' '),BUILD=(2,220)
   OUTFIL FILES=02,SAVE,BUILD=(2,220)                   
/*