Sharing VSAM Data Sets

This topic explains how to share data sets within a single system and among multiple systems. It also describes considerations for sharing VSAM data sets for NSR or LSR/GSR access. For considerations about sharing VSAM data sets for RLS access, see Using VSAM Record-Level Sharing.

This topic covers the following subtopics.

You can share data sets between:
  • Different jobs in a single operating system
  • Multiple ACBs in a task or different subtasks
  • One ACB in a task or different subtasks
  • Different operating systems. To share between different operating systems safely, you need global resource serialization or an equivalent product to implement VSAM SHAREOPTIONS, record-level sharing access, and OPEN/CLOSE/EOV serialization. Failure to use GRS or an equivalent can result in both data set and VTOC/VVDS corruption and other unpredictable results. See z/OS MVS Planning: Global Resource Serialization.

When you define VSAM data sets, you can specify how the data is to be shared within a single system or among multiple systems that can have access to your data and share the same direct access devices. Before you define the level of sharing for a data set, you must evaluate the consequences of reading incorrect data (a loss of read integrity) and writing incorrect data (a loss of write integrity)—situations can result when one or more of the data set's users do not adhere to guidelines recommended for accessing shared data sets.

The extent to which you want your data sets to be shared depends on the application. If your requirements are similar to those of a catalog, where there can be many users on more than one system, more than one user should be permitted to read and update the data set simultaneously. At the other end of the spectrum is an application where high security and data integrity require that only one user at a time have access to the data.

When your program issues a GET request, VSAM reads an entire control interval into virtual storage (or obtains a copy of the data from a control interval already in virtual storage). If your program modifies the control interval's data, VSAM ensures within a single control block structure that you have exclusive use of the information in the control interval until it is written back to the data set. If the data set is accessed by more than one program at a time, and more than one control block structure contains buffers for the data set's control intervals, VSAM cannot ensure that your program has exclusive use of the data. You must obtain exclusive control yourself, using facilities such as ENQ/RESERVE and DEQ.

Two ways to establish the extent of data set sharing are the data set disposition specified in the JCL and the share options specified in the access method services DEFINE or ALTER command. If the VSAM data set cannot be shared because of the disposition specified in the JCL, a scheduler allocation failure occurs. If your program attempts to open a data set that is in use and the share options specified do not permit concurrent use of the data, the open fails, and a return code is set in the ACB error field.

During load mode processing, you cannot share data sets. Share options are overridden during load mode processing. When a shared data set is opened for create or reset processing, your program has exclusive control of the data set within your operating system.

You can use ENQ/DEQ to issue VSAM requests, but not to serialize the system resources that VSAM uses.