z/OS DFSMS Using Data Sets
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Copying and Merging Data Sets

z/OS DFSMS Using Data Sets
SC23-6855-00

You might want to copy a data set or merge two data sets for a variety of reasons. For example, you might want to create a test copy, you might want two copies to use for two different purposes, or you might want to keep a copy of back records before updating a data set. You can use the access method services REPRO command to copy data sets.

For information about accessing a data set using RLS, see Using VSAM Record-Level Sharing.

You can use the REPRO command to do any of the following:
  • Copy or merge a VSAM data set into another VSAM data set.
  • Copy or merge a sequential data set into another sequential data set.
  • Copy an alternate index as a key-sequenced VSAM data set.
  • Copy a VSAM data set whose records are fixed length into an empty fixed-length RRDS.
  • Convert a sequential or indexed sequential data set into a VSAM data set.
  • Copy a VSAM data set into a sequential data set.
  • Copy a data set (other than a catalog) to reorganize it. Data sets are reorganized automatically.
  • Copy individual members of a PDS or PDSE. A PDS or PDSE cannot be copied, but individual members can be copied.

When copying to a key-sequenced data set, the records to be copied must be in ascending order, with no duplicates in the input data set. All the keys must be unique. With an entry-sequenced data set, the records to be copied can be in any order.

Because data is copied as single logical records in either key order or physical order, automatic reorganization can take place as follows:
  • Physical relocation of logical records
  • Alteration of a record's physical position within the data set
  • Redistribution of free space throughout the data set
  • Reconstruction of the VSAM indexes

If you are copying to or from a sequential data set that is not cataloged, you must include the appropriate volume and unit parameters on your DD statements. For more information about these parameters see Using REPRO to Copy a VSAM Data Set.

Table 1 describes how the data from the input data set is added to the output data set when the output data set is an empty or nonempty entry-sequenced, sequential, key-sequenced, or linear data set, or fixed-length or variable-length RRDS.

Table 1. Adding data to various types of output data sets
Type of Data Set Empty Nonempty
Entry sequenced Loads new data set in sequential order. Adds records in sequential order to the end of the data set.
Sequential Loads new data set in sequential order. Adds records in sequential order to the end of the data set.
Key sequenced Loads new data set in key sequence and builds an index. Merges records by key and updates the index. Unless the REPLACE option is specified, records whose key duplicates a key in the output data set are lost.
Linear Loads new linear data set in relative byte order. Adds data to control intervals in sequential order to the end of the data set.
Fixed-length RRDS Loads a new data set in relative record sequence, beginning with relative record number 1. Records from another fixed-length or variable-length RRDS are merged, keeping their old record numbers. Unless the REPLACE option is specified, a new record whose number duplicates an existing record number is lost. Records from any other type of organization cannot be copied into a nonempty fixed-length RRDS.
Variable-length RRDS Loads a new data set in relative record sequence, beginning with relative record number 1. Records from another fixed-length or variable-length RRDS are merged, keeping their old record numbers. Unless the REPLACE option is specified, a new record whose number duplicates an existing record number is lost. Records from any other type of organization cannot be copied into a nonempty fixed-length RRDS.
The REPRO operation is terminated if:
  • One physical I/O error is found while writing to the output data set
  • A total of four errors is found in any combination of the following:
    • Logical error while writing to the output data set
    • Logical error while reading the input data set
    • Physical error while reading the input data set.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014