Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
bamohan,
Here's a sample SyncSort JOIN UNPAIRED application which writes the below outputs. You can adapt this as per your requirement.
MATCH - matching records
NOMATCH1 - non matching records from file1
NOMATCH2 - non matching records from file2
Code: |
//STEP1 EXEC PGM=SORT
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//NOMATCH1 DD SYSOUT=*
//NOMATCH2 DD SYSOUT=*
//MATCH DD SYSOUT=*
//SORTJNF1 DD *
F0 A
F0 B
F0 C
F0 D
F1 P
F1 Q
F1 R
//SORTJNF2 DD *
F2 X
F2 Y
F2 Z
F0 A
F0 B
F0 C
F0 D
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,4,A)
JOINKEYS FILE=F2,FIELDS=(1,4,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,10,F2:1,80),FILL=X'FF'
SORT FIELDS=COPY
OUTFIL FNAMES=NOMATCH1,
INCLUDE=(11,1,BI,EQ,X'FF'),
BUILD=(1,10)
OUTFIL FNAMES=NOMATCH2,
INCLUDE=(1,1,BI,EQ,X'FF'),
BUILD=(11,80)
OUTFIL FNAMES=MATCH,SAVE,
BUILD=(11,80)
|
MATCH
Code: |
F0 A
F0 B
F0 C
F0 D |
NOMATCH1
NOMATCH2
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
bamohan wrote: |
I want to compare two files with a key and if the key matched then those records have to write into o/p file1 and those do not match have to write into a o/p file2. |
Please provide us with the RECFM and LRECL for both input files, along with the position and length of the key fields for each file.
Also, how do you want the output records formatted when there is a match? |
|