Fill Method Paired and unpaired records – This example illustrates an alternative way to create three output files; paired F1/F2 records, unpaired F1 records, and unpaired F2 records. It produces the same output as Example 5. Whereas Example 5 uses an indicator in one position to determine where the key was found, Example 6 uses a fill character in different positions to determine where the key was found. Another drawback of the Example 6 method is that you must use a FILL character that does not appear in either input record. The Explanation for Example 6 is the same as for Example 5 up to the REFORMAT statement and then it differs as follows:
//JKE6 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTJNF1 DD DSN=FIRST.FILE,DISP=SHR //SORTJNF2 DD DSN=SECOND.FILE,DISP=SHR //F1ONLY DD SYSOUT=* //F2ONLY DD SYSOUT=* //BOTH DD SYSOUT=* //SYSIN DD * Control statements for JOINKEYS application JOINKEYS FILE=F1,FIELDS=(1,10,A),SORTED,NOSEQCK JOINKEYS FILE=F2,FIELDS=(7,10,A),SORTED,NOSEQCK JOIN UNPAIRED,F1,F2 REFORMAT FIELDS=(F1:1,14,F2:1,20),FILL=C'$' Control statements for main task (joined records) OPTION COPY OUTFIL FNAMES=F1ONLY,INCLUDE=(15,1,CH,EQ,C'$'), BUILD=(1,14) OUTFIL FNAMES=F2ONLY,INCLUDE=(1,1,CH,EQ,C'$'), BUILD=(15,20) OUTFIL FNAMES=BOTH,INCLUDE=(15,1,CH,NE,C'$',AND,1,1,CH,NE,C'$'), BUILD=(1,14,/,15,20) /*
The REFORMAT statement defines the fields to be extracted for the joined records in the order in which they are to appear. FIELDS=(F1:1,14,F2:1,20)tells DFSORT to create the joined records as follows:
Joined Record Positions Extracted from ----------------------- ----------------- 1-14 F1 positions 1-14 15-34 F2 positions 1-20
FILL=C’$’ tells DFSORT to use $ as the fill character for the F1 field in an unpaired F2 record and for the F2 field in an unpaired F1 record. We use the FILL character to identify the unpaired records from each file; when used for this purpose, the default of FILL=X’40’ is usually not a good choice. You must select a FILL character that will not appear in either input file.
The OPTION COPY statement tells DFSORT to copy the joined records. The OUTFIL statements use the presence or absence of the $ fill character in certain positions to determine where to find the F1 or F2 fields in the joined records and where to write the fields (F1ONLY, F2ONLY or BOTH).
Conceptually, JOINKEYS application processing proceeds as follows:
Carrie F101No Carrie F201
David F102$$$$$$$$$$$$$$$$$$$$
Frank F103$$$$$$$$$$$$$$$$$$$$
Holly F104Yes Holly F202
$$$$$$$$$$$$$$Yes Karen F203
$$$$$$$$$$$$$$No Sri Hari F204
Vicky F105Yes Vicky F205
For F1 records without a match in F2 (for example, the F102 record), the F2 field is filled with the FILL character. For F2 records without a match in F1 (for example, the F203 record), the F1 field is filled with the FILL character. For F1 records with a match in F2 (for example, the F101 and F201 records), no FILL characters are used.
David F102
Frank F103
Yes Karen F203
No Sri Hari F204
Carrie F101
No Carrie F201
Holly F104
Yes Holly F202
Vicky F105
Yes Vicky F205
Note: If you only want one record per key in BOTH, you can have the BUILD for FNAMES=BOTH specify the positions for just that record. For example, BUILD=(1,14) for the F1 records or BUILD=(15,20) for the F2 records.
Example 1 – Paired records without duplicates (F1/F2) Example 2 – Paired records with duplicates (F1/F2) Example 3 – Paired records (F1) Example 4 – Unpaired records (F2) Example 5 – Indicator Method : Paired and unpaired records (F1/F2) Example 6 – Fill Method : Paired and unpaired records (F1/F2)
Read JCL blogs: Click Here SYNCSORT Manual: Click Here
A well-maintained product backlog is crucial for successful product development. It serves as a single…
Incremental value to the customer refers to the gradual delivery of small, functional parts of…
A Product Market refers to the group of potential customers who might be interested in…
The Professional Agile Leadership - Evidence-Based Management (PAL-EBM) certification offered by Scrum.org is designed for…
The Professional Agile Leadership (PAL I) certification, offered by Scrum.org, is designed to equip leaders…
Choosing the right Scrum Master Certification depends on your current experience and career goals. If…