Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
![]() SPLICE operator z/OS DFSORT Application Programming Guide SC23-6878-00 |
|
Splices together specified fields from records with matching numeric or character field values (that is, duplicate values), but different information. This makes it possible to join fields from different types of input records to create an output record with information from two or more records. Typically, you will want to reformat the records from two or more data sets to a temporary MOD data set, and use that temporary MOD data set as input to the SPLICE operator. SPLICE examples shows some techniques for splicing records from different data sets together in a variety of ways to perform various file "join" and "match" operations. By default (when WITHALL, WITHANY and WITHEACH are not specified), one spliced record is created for each set of duplicates by splicing the first duplicate with specified fields from the last duplicate. The first duplicate is treated as a "base record". The last duplicate is treated as an "overlay record". Specified fields from the overlay record are overlaid on to the base record. Thus, the output record consists of fields from the base (first) record intermixed with specified fields from the overlay (last) record. The records to be spliced can originate from two or more different input data sets. From 1 to 10 ON fields can be used for the fields to match on. At least one ON(p,m,f) field must be specified; all such ON fields specified will be used to determine the matching records to be spliced together. From 1 to 50 WITH fields can be used to specify the fields to be overlaid on the base record from the overlay record. At least one WITH(p,m) field must be specified; all such WITH fields specified will be overlaid on to the base record. All other fields in the base record will be kept unchanged. To illustrate the splicing process, if we had the following two fixed-length input records with the base
fields, ON field and WITH fields as shown:
the resulting spliced output record would be:
For variable-length records, by default (without VLENMAX or VLENOVLY),
the spliced record has the same length as the base record, and WITH
fields from the overlay record that are beyond the end of the base
record do not appear in the spliced record. For example, if we had
the following two records with the lengths (in the RDW), ON field
and WITH fields as shown:
the resulting spliced output
record would be:
The WITH2 field
is beyond the end of the base record, so it is not spliced.However, if you specify VLENMAX, the spliced record is given the larger of the base record length or overlay record length. If we specify VLENOVLY, the spliced record is given the overlay record length. In either case, if the overlay record length is larger, bytes in the extended spliced record that are not overlaid are filled in with blanks. The resulting spliced output record with either VLENMAX or VLENOVLY
would be:
You can use
VLENMAX when you want the spliced record to have the maximum length
of the base or overlay record. You can use VLENOVLY when you want
the spliced record to have the length of the overlay record, regardless
of whether it's longer or shorter than the base record. Without VLENMAX
or VLENOVLY, the spliced record has the length of the base record
regardless of whether it's longer or shorter than the overlay record.
For fixed-length records, the length of the base, overlay and spliced records are all the same. Thus, VLENOVLY and VLENMAX have no meaning for fixed-length records and are ignored. WITHALL can be used to create multiple spliced records for each set of duplicates. The first duplicate is spliced with the specified fields from the second duplicate. Then the first duplicate is spliced with the specified fields from the third duplicate, and so on. The first duplicate is treated as a base record. Each subsequent duplicate is treated as an overlay record. The specified fields from each overlay record are overlaid on to the base record. Thus, the output records consist of fields from the base record intermixed with specified nonblank and blank fields from the overlay records. The records to be spliced can originate from multiple input data sets. To illustrate the splicing process when WITHALL is specified, if
we had the following four fixed-length records
with the base fields, ON field and WITH fields as shown:
The resulting three spliced output records would be:
Note that without WITHALL, the resulting single spliced output
record would be:
For variable-length records, by default (without VLENMAX or VLENOVLY),
the spliced record has the same length as the base record, and WITH
fields from the overlay record that are beyond the end of the base
record do not appear in the spliced record. For example, with WITHALL,
if we had the following four records with the lengths (in the RDW),
ON field and WITH fields as shown:
the resulting three spliced
output records would be:
The WITHC, WITHD and WITHF fields are beyond the end of the base record, so they are not spliced. However, if you specify VLENMAX, the spliced record is given the
larger of the base record length or overlay record length. If we specify
VLENOVLY, the spliced record is given the overlay record length.
In either case, if the overlay record length is larger, bytes in the
extended spliced record that are not overlaid are filled in with blanks.
The resulting three spliced output records with WITHALL and VLENMAX
would be:
The resulting three spliced output records with WITHALL and VLENOVLY
would be:
WITHANY can be used to create one spliced record for each set of duplicates. The first duplicate is spliced with the nonblank values of each subsequent duplicate for specified fields. The first duplicate is treated as a base record. Each subsequent duplicate is treated as an overlay record. Each specified field with a nonblank value in each overlay record is overlaid on to the base record. Thus, the output record consists of fields from the base record intermixed with specified nonblank fields from each overlay record. The value from the last overlay record with each nonblank value will appear in the output record. Note that a specified "field" from an overlay record can actually consist of multiple fields from the record that have previously been reformatted into one contiguous field. The records to be spliced can originate from multiple input data sets. To illustrate the splicing process when WITHANY is
specified, if we had the following four fixed-length records with
the base fields, ON field and WITH fields as shown:
The resulting spliced output record would be:
For variable-length records, by default (without
VLENMAX), the spliced record has the same length as the base record.
For example, with WITHANY, if we had the following four records with
the lengths (in the RDW), ON field and WITH fields as shown:
the resulting spliced output records would be:
The WITHB and WITHC fields are beyond the end of
the base record, so they are not spliced. However, if you specify
VLENMAX, the spliced record is given the largest of the base record
length or overlay record lengths. If the largest overlay record length
is larger than the base record length, bytes in the extended spliced
record that are not overlaid are filled in with blanks. The resulting
spliced output record with WITHANY and VLENMAX would be:
VLENOVLY cannot be specified with WITHANY. WITHEACH can be used to create one spliced record for each set of duplicates. The first duplicate is spliced with one specified field from each subsequent duplicate. The first duplicate is treated as a base record. Each subsequent duplicate is treated as an overlay record. The specified blank or nonblank field from each overlay record is overlaid on to the base record. Thus, the output record consists of fields from the base record intermixed with a specified nonblank or blank field from each overlay record. Note that the specified "field" from an overlay record can actually consist of multiple fields from the record that have previously been reformatted into one contiguous field. The records to be spliced can originate from multiple input data sets To illustrate the splicing process when WITHEACH
is specified, if we had the following four records with the base fields,
ON field and WITH fields as shown:
The resulting spliced output record would be:
For variable-length records, by default (without
VLENMAX), the spliced record has the same length as the base record.
For example, with WITHEACH, if we had the following four records with
the lengths (in the RDW), ON field and WITH fields as shown:
the resulting spliced
output records would be:
The WITHB and WITHC fields are beyond the end of the base record, so they are not spliced. However, if you specify VLENMAX, the spliced record
is given the largest of the base record length or overlay record lengths.
If the largest overlay record length is larger than the base record
length, bytes in the extended spliced record that are not overlaid
are filled in with blanks. The resulting spliced output record with
WITHEACH and VLENMAX would be:
VLENOVLY cannot be specified with WITHEACH. KEEPNODUPS can be used to keep the non-duplicate records as well as the spliced records. The non-duplicate records will be unchanged. To illustrate the splicing process when KEEPNODUPS is specified,
if we had the following six records with the base fields, ON fields
and WITH fields as shown:
The two unique records (ONA and OND) would
be kept along with the two spliced records (ONB and OND). The resulting
four unspliced and spliced output records would be:
Note that without KEEPNODUPS, the two unique records (ONA and ONC)
would not be kept. The resulting two spliced output records would
be:
KEEPBASE can be used to keep the base records (first duplicate) as well as the spliced records. The base records will be unchanged. To illustrate the splicing process when KEEPBASE is specified,
if we had the following six records with the base fields, ON fields
and WITH fields as shown:
The two base records with duplicates (first
ONB record and first OND record) would be kept along with the two
spliced records (ONB and OND). The resulting four unspliced and spliced
output records would be:
Note that without KEEPBASE, the two base
records with duplicates (first ONB record and first OND record) would
not be kept. The resulting two spliced output records would be:
If we used KEEPNODUPS and KEEPBASE with the
original six records, the resulting six unspliced and spliced output
records would be:
DFSORT is called to sort the indd data set. ICETOOL uses its E35 exit to determine which records to splice and include in the outdd data set. ICETOOL passes the EQUALS option to DFSORT to ensure that duplicates are kept in their original input order. The DFSORT control statements in xxxxCNTL are used if USING(xxxx) is specified. Do not supply your own MODS, SUM, OUTREC, or SORT statement. You can use comment statements. You can use INCLUDE,
OMIT, INREC, OPTION, and OUTFIL statements providing you observe these
rules:
The DYNALLOC option is passed to DFSORT to ensure that work space
is available for the sort. If your installation defaults for dynamic
allocation are inappropriate for a SPLICE operator, you can specify
USING(xxxx) and take one of the following actions:
Tape work data sets cannot be used with ICETOOL. ![]() ![]() ![]() |
![]() |