Comparing 2 different length file and creating 2 other files



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Comparing 2 different length file and creating 2 other files

Postby averagebob » Mon Mar 21, 2011 7:36 pm

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
averagebob
 
Posts: 1
Joined: Mon Mar 21, 2011 7:21 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby Alissa Margulies » Tue Mar 22, 2011 10:18 pm

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)                   
/*
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post