See sample JCL and control statements for a simple JOINKEYS application to do an inner join (also known as a cartesian join) which joins all paired records.
//STEP01 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTJNF1 DD DSN=INPUT DATASET 1,DISP=SHR //SORTJNF2 DD DSN=INPUT DATASET 2,DISP=SHR //SORTOUT DD SYSOUT=* //SYSIN DD * * Control statements for JOINKEYS application JOINKEYS FILE=F1,FIELDS=(15,2,A,7,4,A) JOINKEYS FILE=F2,FIELDS=(21,2,A,23,4,A) REFORMAT FIELDS=(F2:1,70,F1:1,60) * Control statements for main task (joined records) SORT FIELDS=COPY /* |
Invokes DFSORT. PGM=ICEMAN can also be used.
Messages from the main task. An alternate ddname can be supplied with MSGDDN=ddname in //DFSPARM.
F1 input file (read by subtask1). The ddname is SORTJNF1 (or ccccJNF1 if SORTDD=cccc is in effect) if FILE=F1 or FILES=F1 is specified on the JOINKEYS statement. An alternate ddname can be supplied with F1=ddname on the JOINKEYS statement.
F2 input file (read by subtask2). The ddname is SORTJNF2 (or ccccJNF2 if SORTDD=cccc is in effect) if FILE=F2 or FILES=F2 is specified on the JOINKEYS statement. An alternate ddname can be supplied with F2=ddname on the JOINKEYS statement.
Output of joined records (written by main task). An alternate ddname can be supplied with SORTOUT=ddname or SORTDD=cccc in //DFSPARM or with the OUTFIL statement in //SYSIN or //DFSPARM.
Control statements for the main task including JOINKEYS, JOIN, REFORMAT, OPTION, SORT, INCLUDE or OMIT, SUM, OUTREC, RECORD, ALTSEQ, MODS and OUTFIL. If SKIPREC or E15 is specified, it will not be used.
DFSPARM can be used if DFSORT is invoked directly or called from a program. SYSIN can be used if DFSORT is invoked directly. SORTCNTL can be used if DFSORT is called from a program; an alternate ddname of ccccCNTL can be supplied with SORTDD=cccc in DFSPARM.
Below JCL statements used for a JOINKEYS application are optional:
DFSORT symbols for the main task, subtask1 and subtask2.
Listing of symbols supplied via the SYMNAMES DD.
Messages from subtask1. This message data set will be dynamically allocated with SYSOUT=*, RECFM=FBA, LRECL=121 and BLKSIZE=121 if a JNF1JMSG DD statement is not supplied.
If a JNF1JMSG DD statement is supplied, this message data set will be given the same attributes as a //SYSOUT message data set. An alternate ddname of idF1JMSG can be supplied with TASKID=id on the JOINKEYS statement for F1.
Messages from subtask2. This message data set will be dynamically allocated with SYSOUT=*, RECFM=FBA, LRECL=121 and BLKSIZE=121 if a JNF2JMSG DD statement is not supplied.
If a JNF2JMSG DD statement is supplied, this message data set will be given the same attributes as a //SYSOUT message data set. An alternate ddname of idF2JMSG can be supplied with TASKID=id on the JOINKEYS statement for F2.
Control statements for subtask1 including INCLUDE or OMIT, OPTION, MODS, RECORD, ALTSEQ, INREC and SUM. If E35 is specified, it will not be used. The following control statements must not be specified: JOINKEYS, JOIN, REFORMAT, MERGE, OUTFIL, OUTREC or SORT.
An alternate ddname of idF1CNTL can be supplied with TASKID=id on the JOINKEYS statement for F1.
Control statements for subtask2 including INCLUDE or OMIT, OPTION, MODS, RECORD, ALTSEQ, INREC and SUM. If E35 is specified, it will not be used. The following control statements must not be specified: JOINKEYS, JOIN, REFORMAT, MERGE, OUTFIL, OUTREC or SORT.
An alternate ddname of idF2CNTL can be supplied with TASKID=id on the JOINKEYS statement for F2.
Work data sets for the main task. Not recommended since dynamic allocation of work data sets is preferred. Alternate ddnames of ccccWKdd can be supplied with SORTDD=cccc in //DFSPARM.
Work data sets for subtask1. Not recommended since dynamic allocation of work data sets will be enabled. Alternate ddnames of idF1WKdd can be supplied with TASKID=id on the JOINKEYS statement for F1.
Work data sets for subtask2. Not recommended since dynamic allocation of work data sets will be enabled. Alternate ddnames of idF2WKdd can be supplied with TASKID=id on the JOINKEYS statement for F2.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!