VSAM RLS provides three levels of read integrity as follows:
- NRI—no read integrity
This tells VSAM RLS not to obtain
a record lock on the record accessed by a GET or POINT request. This
avoids the overhead of record locking. This is sometimes referred
to as dirty read because the reader might see an uncommitted change
made by another transaction.
Even with this option specified,
VSAM RLS still performs buffer validity checking and buffer refresh
when the buffer is invalid. Thus, a sequential reader of a KSDS does
not miss records that are moved to new control intervals by control
interval (CI) and control area (CA) splits.
There are situations
where VSAM RLS temporarily obtains a shared lock on the record even
though NRI is specified. This situation happens when the read encounters
an inconsistency within the VSAM data set while attempting to access
the record. An example of this is path access through an alternate
index to a record for which a concurrent alternate index upgrade is
being performed. The path access sees an inconsistency between the
alternate index and base cluster. This would normally result in an
error response return code 8 and reason code 144. Before giving this
response to the NRI request, VSAM RLS obtains a shared lock on the
base cluster record that was pointed to by the alternate index. This
ensures that if the record was being modified, the change and corresponding
alternate index upgrade completes. The record lock is released. VSAM
retries the access. The retry should find the record correctly. This
internal record locking may encounter locking errors such as deadlock
or timeout. Your applications must be prepared to accept locking error
return codes that may be returned on GET or POINT NRI requests. Normally
such errors will not occur.
- CR—consistent read
This tells VSAM RLS to obtain a SHARE
lock on the record accessed by a GET or POINT request. It ensures
the reader does not see an uncommitted change made by another transaction.
Instead, the GET/POINT waits for the change to be committed or backed
out and the EXCLUSIVE lock on the record to be released.
- CRE—consistent read explicit
This is the same as CR, except
VSAM RLS keeps the SHARE lock on the record until end-of-transaction.
This option is only available to CICS or DFSMStvs transactions. VSAM
does not understand end-of-transaction for non-CICS or non-DFSMStvs
usage.
This capability is often referred to as REPEATABLE READ.
The record locks obtained by the VSAM RLS GET requests with CRE
option inhibit update or erase of the records by other concurrently
executing transactions. However, the CRE requests do not inhibit the
insert of other records by other transactions. The following cases
need to be considered when using this function.
- If a GET DIR (direct) or SKP (skip sequential) request with CRE
option receives a “record not found” response, VSAM RLS does
not retain a lock on the nonexistent record. The record could be inserted
by another transaction.
- A sequence of GET SEQ (sequential) requests with CRE option results
in a lock being held on each record that was returned. However, no
additional locks are held that would inhibit the insert of new records
in between the records locked by the GET CRE sequential processing.
If the application were to re-execute the previously executed sequence
of GET SEQ,CRE requests, it would see any newly inserted records.
Within the transactional recovery community, these records are referred
to as “phantom” records. The VSAM RLS CRE function does not
inhibit phantom records.