Page 1 of 1

Syncsort Join

PostPosted: Thu Nov 04, 2010 8:40 pm
by Eagle
I have two input files, "File 1" and "File 2" that have the same record length and format. I want to use Syncsort to to remove the records that exist on File 1 from File 2 and write all records from File 1 and only the unmatched records from File 2 in one output file. The matched records from File 2 can be discarded.

Questions:
What tool should I use?
Can this be done in one sort step?
If so, can you provide a generic example?
If not, I can easily accomplish this with two steps.

The key is the first 33 bytes of the 500-byte LRECL. Sample data:
IN   00101ABC00000000000123456789
IN   00101DEF00000000000234567890

Re: Syncsort Join

PostPosted: Thu Nov 04, 2010 10:45 pm
by Eagle
One additional note: Duplicates should not be removed.

Re: Syncsort Join

PostPosted: Thu Nov 04, 2010 11:47 pm
by Alissa Margulies
Here is a sample job that may help you:
//STEP1  EXEC PGM=SORT                                 
//SORTJNF1 DD DSN=FILE1       
//SORTJNF2 DD DSN=FILE2
//SORTOUT  DD SYSOUT=*                                 
//SYSOUT   DD SYSOUT=*                                 
//SYSIN    DD *                                         
  JOINKEYS FILES=F1,FIELDS=(1,33,A)                   
  JOINKEYS FILES=F2,FIELDS=(1,33,A)                   
  JOIN UNPAIRED                                       
  REFORMAT FIELDS=(F1:1,500,F2:1,500)                   
  SORT FIELDS=COPY                                   
  OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C' '),BUILD=(501,500)),
         IFTHEN=(WHEN=NONE,BUILD=(1,500))           

Re: Syncsort Join

PostPosted: Fri Nov 05, 2010 12:08 am
by Eagle
Thank you, Alissa!