Comparing 2 files with duplicate keys



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

Comparing 2 files with duplicate keys

Postby onkara » Wed Apr 06, 2011 12:19 am

FIle-1:
Format=VB, length=255
Key position = 1,6,a, 8,4,a,15,1,a

FIle-2:
Format=vb, length=255
Key position = 1,6,a, 28,4,a, 46,1,a

File-1 contains multiple rows of matching records with file-2. Similarly file-2 also contains multiple rows of matching record with file-1.

Requirement: Using file-1 has driver select all rows with matching records from file-2 and create the formatted output as follows.

Output file should be copy all rows from file-1 and MATCHED rows from file-2. Any unmatched rows in file-2 should not be copied to output file.

We are using SYNCSORT vendor tool and please provide JOINKEYS suntax. Thx
onkara
 
Posts: 1
Joined: Wed Apr 06, 2011 12:03 am
Has thanked: 0 time
Been thanked: 0 time

Re: Comparing 2 files with duplicate keys

Postby Alissa Margulies » Fri Apr 29, 2011 8:26 pm

Hello onkara.

Try the following:
//STEP1  EXEC PGM=SORT             
//SORTJNF1 DD DSN=INPUT.FILE1  (VB/255)
//SORTJNF2 DD DSN=INPUT.FILE2  (VB/255)                   
//SORTOUT  DD DSN=OUTPUT.FILE  (VB/255)
//SYSOUT   DD SYSOUT=*             
//SYSIN    DD *                   
  JOINKEYS FILES=F1,FIELDS=(5,6,A,12,4,A,19,1,A)
  JOINKEYS FILES=F2,FIELDS=(5,6,A,32,4,A,50,1,A)
  JOIN UNPAIRED,F1                 
  REFORMAT FIELDS=(F1:5,251,F2:5,251) 
  SORT FIELDS=COPY
  OUTFIL FILES=OUT,                   
   IFTHEN=(WHEN=(252,1,CH,EQ,C' '),BUILD=(1,251)),               
   IFTHEN=(WHEN=(252,1,CH,NE,C' '),BUILD=(1,251,/,252,251)),
   FTOV   
/*                         
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