IBM SC34-7012-01 Server User Manual


 
The extended period of locking is needed to avoid an update committed by one
task being backed out by another. (Consider what could happen if the
nonextended locking action shown in Figure 13 on page 155 was used when
updating a recoverable file. If task A abends just after task B has reached
syncpoint and has thus committed its changes, the subsequent backout of task A
returns the file to the state it was in at the beginning of task A, and task B’s
committed update is lost.)
To avoid this problem, whenever a transaction issues a command that changes a
recoverable file (or reads from a recoverable file before update), CICS automatically
locks the updated record until the change is committed (that is, until the end of the
unit of work). Thus in the above example, Task B would not be able to access the
record until Task A had committed its change at the end of the unit of work.
Hence, it becomes impossible for Task B’s update to be lost by a backout of Task
A. For files opened in non-RLS mode, CICS provides this locking using the
enqueue domain. For files opened in RLS mode, SMSVSAM provides the locking,
and the locks are released at the completion of the unit of work at the request of
CICS.
The file control commands that invoke automatic locking in this way are:
v READ (for UPDATE)
v WRITE
v DELETE
Note:
1. Enqueuing as described above can lead to transaction deadlock (see
“Possibility of transaction deadlock” on page 159).
2. The scope of locks varies according to the access method, the type of access,
and who obtains the lock:
v BDAM exclusive control applies to the physical block
v Non-RLS VSAM exclusive control applies to the control interval
v CICS locks for BDAM (with NOEXCTL specified) apply to the record only
v CICS locks for non-RLS VSAM apply to the record only
v SMSVSAM locks for RLS apply to the record only
3. VSAM exclusive control. The CICS enqueuing action on recoverable files
opened in non-RLS mode lasts until the end of the unit of work. When a
transaction issues a READ UPDATE command, VSAM's exclusive control of the
control interval containing the record is held only long enough for CICS to
issue an ENQ on the record. CICS then notifies VSAM to release the exclusive
control of the CI, and re-acquires this only when the task issues a REWRITE (or
UNLOCK, DELETE, or SYNCPOINT) command. Releasing the VSAM exclusive
CI lock until the task is ready to rewrite the record minimises the potential for
transaction deadlock
4. For recoverable files, do not use unique key alternate indexes (AIXs) to allocate
unique resources (represented by the alternate key). If you do, backout may fail
in the following set of circumstances:
a. A task deletes or updates a record (through the base or another AIX) and
the AIX key is changed.
b. Before the end of the first task’s unit of work, a second task inserts a new
record with the original AIX key, or changes an existing AIX key to that of
the original one.
c. The first task fails and backout is attempted.
156 CICS TS for z/OS 4.1: Recovery and Restart Guide