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


Closing Data Sets

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

The CLOSE macro disconnects your program from a data set. It causes VSAM to take the following actions:
  • Write any unwritten data or index records whose contents have changed.
  • Update the catalog entry for the data set if necessary (if the location of the end-of-file indicator has changed, for example).
  • Write SMF records if SMF is being used.
  • Restore control blocks to the status they had before the data set was opened.
  • Release virtual storage obtained during OPEN processing for additional VSAM control blocks and VSAM routines.
  • If partial release was specified at open time, release all space after the high-used RBA (on a CA boundary of non-EAV data sets, or on an MCU boundary for EAV data sets) up to the high-allocated RBA .

If a record management error occurs while CLOSE is flushing buffers, the data set's catalog information is not updated. The catalog cannot properly reflect the data set's status and the index cannot accurately reflect some of the data records. If the program enters an abnormal termination routine (ABEND), all open data sets are closed. The VSAM CLOSE invoked by ABEND does not update the data set's catalog information, it does not complete outstanding I/O requests, and buffers are not flushed. The catalog cannot properly reflect the cluster's status, and the index cannot accurately reference some of the data records. Use the access method services VERIFY command to correct catalog information. The use of VERIFY is described in Using VERIFY to Process Improperly Closed Data Sets.

When processing asynchronous VSAM requests, all strings must be quiesced by issuing the CHECK macro or the ENDREQ macro before issuing CLOSE or CLOSE TYPE=T (temporary CLOSE).

CLOSE TYPE=T causes VSAM to complete any outstanding I/O operations, update the catalog if necessary, and write any required SMF records. Processing can continue after a temporary CLOSE without issuing an OPEN macro.

If a VSAM data set is closed and CLOSE TYPE=T is not specified, you must reopen the data set before performing any additional processing on it.

When you issue a temporary or a permanent CLOSE macro, VSAM updates the data set's catalog records. If your program ends with an abnormal end (ABEND) without closing a VSAM data set the data set's catalog records are not updated, and contain inaccurate statistics.

It is the user's responsibility to ensure that shared DD statements are not dynamically deallocated until all ACBs that share these DD statements are closed. For more information about dynamic allocation, see z/OS MVS JCL User's Guide.

Restriction: The following close options are ignored for VSAM data sets:
  • FREE=CLOSE JCL parameter
  • FREE=CLOSE requested through dynamic allocation, DALCLOSE

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014