JCL - Sort Joinkeys
In sql, you can perform left outer join, right outer join or full outer join. Similar logic can be performed in JCL using JOINKEYS. Example of JOIN KEYS for Emp and Dept file logic JCL DD statements: //SORTJNF1 DD DSN=USERID.INPUT.PS1,DISP=SHR //SORTJNF2 DD DSN=USERID.INPUT.PS2,DISP=SHR //SORTOUT1 DD DSN=USERID.OUTPUT.PSOUT,DISP=OLD When the JOIN statement is not specified, paired records from F1 and F2 are written into the output file. JOINKEYS FILES=F1,FIELDS=(20,4,A) JOINKEYS FILES=F2,FIELDS=(1,4,A) REFORMAT FIELDS=(F1:1,3,F1:5,10,F2:6,20) SORT FIELDS=COPY When you include the JOIN statement, it returns the following result in the output file. UNPAIRED,F1,F2 or UNPAIRED or UNPAIRED BOTH - Unpaired records from F1 and F2 as well as paired records. This works like a full outer join. UNPAIRED,F1 - Unpaired records from F1 as well as paired records. This works like a left outer join. UNPAIRED,F2 - Unpaired records from F2 as well as paired records. This works like a right outer join. UNPAIRED,F1,F2,ONLY or UNPAIRED,ONLY - Unpaired records from F1 and F2. UNPAIRED,F1,ONLY - Unpaired records from F1. Can not use REFORMAT in F2. UNPAIRED,F2,ONLY - Unpaired records from F2. Cannot use REFORMAT in F1.
Download
0 formatsNo download links available.