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


Using a Program to Load a Data Set

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

To use your own program to load a key-sequenced data set, first sort the records (or build them) in key sequence, then store them sequentially (using the PUT macro). When you are initially loading a data set, direct access is not permitted. For more information about inserting records into a data set, see Inserting and Adding Records.

VSAM uses the high-used RBA field to determine whether a data set is empty. An implicit verify can update the high-used RBA. Immediately after definition of a data set, the high-used RBA value is zero. An empty data set cannot be verified.

The terms create mode, load mode, and initial data set load are synonyms for the process of inserting records into an empty VSAM data set. To start loading an empty VSAM data set, call the VSAM OPEN macro. Following a successful open, the load continues while records are added and concludes when the data set is closed.

Restriction: If an entry-sequenced data set fails to load, you cannot open it.

Certain restrictions apply during load mode processing:
  • PUT and CHECK are the only macros you can use.
  • Do not use improved control interval processing.
  • You cannot do update or input processing until the data set has been loaded and closed.
  • Specify only one string in the ACB (STRNO>1 is not permitted).
  • Do not specify local shared resources (LSR) or global shared resources (GSR).
  • You cannot share the data set.
  • Direct processing is not permitted (except relative record keyed direct).

If the design of your application calls for direct processing during load mode, you can avoid this restriction by following these steps:

  1. Open the empty data set for load mode processing.
  2. Sequentially write one or more records, which could be dummy records.
  3. Close the data set to terminate load mode processing.
  4. Reopen the data set for normal processing. You can now resume loading or do direct processing. When using this method to load a VSAM data set, be cautious about specifying partial release. Once the data set is closed, partial release will attempt to release all space not used.

For information about using user-written exit routines when loading records into a data set, see Coding VSAM User-Written Exit Routines.

During load mode, each control area can be preformatted as records are loaded into it. Preformatting is useful for recovery if an error occurs during loading. However, performance is better during initial data set load without preformatting. The RECOVERY parameter of the access method services DEFINE command is used to indicate that VSAM is to preformat control areas during load mode. In the case of a fixed-length RRDS and SPEED, a control area in which a record is inserted during load mode will always be preformatted. With RECOVERY, all control areas will be preformatted.

Preformatting clears all previous information from the direct access storage area and writes end-of-file indicators. For VSAM, an end-of-file indicator consists of a control interval with a CIDF equal to zeros.
  • For an entry-sequenced data set, VSAM writes an end-of-file indicator in every control interval in the control area.
  • For a key-sequenced data set, VSAM writes an end-of-file indicator in the first control interval in the control area following the preformatted control area. (The preformatted control area contains free control intervals.)
  • For a fixed-length RRDS, VSAM writes an end-of-file indicator in the first control interval in the control area following the preformatted control area. All RDFs in an empty preformatted control interval are marked "slot empty".

As records are loaded into a preformatted control area of an entry-sequenced data set, an end-of-file indicator following the records indicates how far loading has progressed. You can then resume loading at that point, after verifying the data set. (You cannot open the data set unless you first verify it.) If an error occurs that prevents loading from continuing, you can identify the last successfully loaded record by reading to end of file.

The SPEED parameter does not preformat the data control areas. It writes an end-of-file indicator only after the last record is loaded. Performance is better if you use the SPEED parameter and if using extended format data sets. Extended format data sets may use system-managed buffering. This permits the number of data buffers to be optimized for load mode processing. This can be used with the REPRO parameter for a new data set for reorganization or recovery. If an error occurs that prevents loading from continuing, you cannot identify the last successfully loaded record and you might have to reload the records from the beginning. For a key-sequenced data set, the SPEED parameter only affects the data component.

Rule: Remember that, if you specify SPEED, it will be in effect for load mode processing. After load mode processing, RECOVERY will be in effect, regardless of the DEFINE specification.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014