Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Example 5 - Create multiple spliced records for each match in two types of records z/OS DFSORT Application Programming Guide SC23-6878-00 |
|
This example shows how you can use the WITHALL operand to tell ICETOOL to splice data together for a single record of one type (A records) and multiple records of another type (H records), in the same input data set, that all have the same ON field (duplicate records). It also shows how to ensure that duplicates of the second type without a match of the first type are not written to the output data set. IFTHEN clauses are used in an INREC statement to reformat the two types of records appropriately before they are sorted and spliced
The base records are the records in MAST with an
'A' in column 1. They are reformatted by the INREC statement as 33
byte records that look like this:
We put a 'B' in position 33 to identify these records as base records. The overlay records are the records in MAST with
an 'H' in column 1. They are reformatted by the INREC statement as
33 bytes records that look like this:
We put a 'V' in position 33 to identify these records as overlay records. The base and overlay records set up by the INREC statement are sorted and spliced. The records look like this after they are
sorted on the 20,3,CH field, but before they
are spliced. As a visual aid, the WITH fields in the overlay records
are shown in bold.
The spliced output records are 33 bytes long and look like this:
Note that the base record (type A) for FLY has been spliced together with each of the three overlay records (type H) for FLY. Likewise, the base record (type A) for KRS has been spliced together with each of the two overlay records (type H) for KRS. But also note that the overlay records (type H) for KHN have been spliced together. Because KHN does not appear as a base record (type A) we don't want the KHN records to appear in the OUT data set. So we will use the 'V' we put in position 33 for the overlay records to identify and delete spliced overlay records without a matching base record. We only have to do this if we have duplicate overlay records without a matching base record. Single overlay records without a matching base record will be deleted automatically (unless you specify KEEPNODUPS). After we eliminate the spliced overlay records and the position
33 indicator, the OUT records are 32 bytes long and look like this:
Note that if we had not specified WITHALL, only the
first and last records for each set of duplicates would have been
spliced, producing the following output:
|
Copyright IBM Corporation 1990, 2014
|