Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Example 6 - Pull records from a master file in sorted order z/OS DFSORT Application Programming Guide SC23-6878-00 |
|
This example shows how you can use the WITHALL operand to tell ICETOOL to use ON fields in a "PULL" data set to select one or more records from a "MASTER" data set. In other words, you can use a PULL list to select records from a MASTER list. In this case, the PULL data set has VB records and the MASTER data set has FB records. The ON field is a City Name that can be 1-20 bytes long, and the selected MASTER records are to be sorted by the City Name. (Example 7 - Pull records from a master file in their original order shows how to keep the MASTER records in their original order.)
The base records originate from the PULL data set (VAR.PULL.FILE).
The PULL data set has variable-length (VB) records with the RDW in
positions 1-4 and the variable-length City Name starting in position
5 for 1-20 bytes. Conceptually, the PULL records look like this:
The overlay records originate from the MASTER data set (FIXED.MASTER.FILE). The MASTER data set has 40-byte fixed-length (FB) records with the City Name in positions 1-20. The PULL records are copied and reformatted to the TEMP1 data set
as 41-byte fixed-length (FB) records with the City Name in positions
1-20 (padded on the right with blanks as necessary), and a 'P' in
position 41 to identify them as PULL records. The VTOF and OUTREC
parameters of DFSORT's OUTFIL statement are used to convert the VB
records to FB records with blank padding. The reformatted PULL records in TEMP1 look like this:
The MASTER records are copied and reformatted to the end
(MOD) of the TEMP1 data set as 41-byte fixed-length (FB) records
with an 'M' added in position 41 to identify them as MASTER records.
The reformatted MASTER records in TEMP1 look
like this:
The base and overlay records from the TEMP1 data set are sorted and spliced. The records look like this after they are
sorted on the 1,20,CH field, but before they
are spliced. As a visual aid, the WITH fields in the overlay records
are shown in bold.
The spliced records look like this:
Finally, we use the OUTFIL statement for SPLICE to remove each spliced record with an 'M' in position 41, because that represents a base record without a matching overlay record. The OUTFIL statement also removes the 'P' indicator in position 41 from each record, because it is not needed in the OUT data set. Thus, for each MASTER record that matches a PULL record, we've
overlaid the PULL record with the MASTER record. This effectively
selects all of the MASTER records on the PULL list. The resulting
OUT data set (FIXED.OUTPUT.FILE) has the following 40-byte fixed-length
records:
|
Copyright IBM Corporation 1990, 2014
|