>>1. SUM FIELDS=NONEĀ - is it just to omit duplicates of SUM records?
Radoslaw, I used SUM FIELDS=NONE, to eliminate a cartesian join when matching. For example if you have 10 duplicates for key 'ABC' and 5 duplicates for 'SUM' then the result will be a cartesian join of (10 X 5 = 50 records). So I eliminated the duplicates on key SUM so that it will only produce 10 records for 'ABC' >>2. How to get ABC records with no corresponding SUM record? By default Joinkeys produces only matched records, however it is a simple fix to get the unmatched records using JOIN UNPAIRED. You can find detailed information about the various types of joins here https://www.ibm.com/docs/en/zos/2.4.0?topic=files-join-statement So use the updated control cards. //SORTOUT DD SYSOUT=* //MATCH DD SYSOUT=* //ONLYF1 DD SYSOUT=* //SYSIN DD * OPTION COPY JOINKEYS F1=INA,FIELDS=(96,10,A) JOINKEYS F2=INB,FIELDS=(14,10,A) JOIN UNPAIRED,F1 REFORMAT FIELDS=(F1:1,4,?,F1:5) OUTFIL FNAMES=MATCH, INCLUDE=(5,1,CH,EQ,C'B'), BUILD=(1,4,6) OUTFIL FNAMES=ONLYF1, INCLUDE=(5,1,CH,EQ,C'1'), BUILD=(1,4,6) /* Also please go thru the various examples of Joinkeys shown here https://www.ibm.com/docs/en/zos/2.4.0?topic=files-joinkeys-application-examples Thanks, Kolusu DFSORT Development IBM Corporation ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN