VSAM record level sharing and transactional VSAM

VSAM Record Level Sharing (RLS) and Transactional VSAM (VSAM RLS/TVS) provide for the sharing of VSAM data at the record level, using the locking and caching functions of the coupling facility hardware. For more information on Record Level Sharing, see z/OS DFSMS Introduction.

The C/C++ runtime library provides the following support for VSAM RLS/TVS:

VSAM RLS/TVS has three read integrity file access modes. These modes tell VSAM the level of locking to perform when records are accessed within a file that has not been opened in update mode. The access modes are:
nri
No Read Integrity indicates that requests performed by the application are not to be serialized with updates or erases of the records by other calling programs. VSAM accesses the records without obtaining a lock on the record.
cr
Consistent Read indicates that requests performed by the application are to be serialized with updates or erases of the records by other calling programs. VSAM obtains a share lock when accessing the record. This lock is released once the record has been returned to the caller.
cre
Consistent Read Explicit indicates that requests performed by the application are to be serialized with updates or erases of the records by other requestors.VSAM obtains a share lock when accessing the record. This lock is held until the application commits its changes. This ensures that records read by the application are not changed by other requestors until the application commits or aborts its changes. Consistent Read Explicit is for use only by commit protocol applications.

VSAM RLS locks records to support record integrity. An application may wait for an exclusive record lock if another user has the record locked. The application is also subject to new locking errors such as deadlock or timeout errors.

If the file has been opened in update mode, and RLS=CR or RLS=CRE is specified, VSAM also serializes access to the records within the file. However, the type of serialization differs from non-update mode in the following ways:
  • A reposition within the file causes VSAM to obtain a share lock for the record.
  • A read of a record causes VSAM to obtain an exclusive lock for the record. The lock is held until the record is updated in the file, or another record is read. If RLS=CRE is specified (for commit protocol applications), the lock is held until the application commits or aborts its changes.
Notes:
  1. When a file is opened, it is implicitly positioned to the first record to be accessed.
  2. You can also specify the RLS/TVS keyword on the JCL DD statement. When specified on both the JCL DD statement and in the mode string on fopen() or freopen(), the read integrity options specified in the mode string override those specified on the JCL DD statement.
  3. VSAM RLS/TVS access is supported for the 3 types of VSAM files that the C/C++ runtime library supports: Key-Sequenced (KSDS), Entry-Sequenced (ESDS), and Relative Record (RRDS) data sets.
  4. VSAM RLS/TVS functions require the use of a Coupling Facility. For more information on using the Coupling Facility, see z/OS DFSMS Introduction, and z/OS® Parallel Sysplex® Overview.
  5. In an environment where one thread opens and another thread issues record management requests, VSAM RLS/TVS requires that record management requests be issued from a thread whose Task Control Block (TCB) is subordinate to the TCB of the thread which opened the file.
  6. VSAM RLS/TVS does not support the following:
    • Key range data sets
    • Direct open of an AIX® cluster as a KSDS
    • Access to individual components of a cluster
    • OS Checkpoint and Restart