Previous Topic: Logical Area LocksNext Topic: Record Locks


Area Locking for SQL Transactions

When Area Locks are Acquired

The time at which area locks are acquired for SQL transactions varies depending on the lock acquisition mode in effect. There are two lock acquisition modes:

On First Database Access

The preclaim mode directs CA IDMS to place locks on all areas in a transaction that use the preclaim acquisition mode as soon as the first statement that requires access to the database is executed.

You can use the preclaim mode to reduce the likelihood of deadlocks. A transaction that uses the preclaim option to lock an area will not wait for an area that is held by another transaction while it holds a lock on an area.

On First Area Access

The incremental mode directs CA IDMS to delay placing a lock on an area until the first statement in the transaction that requires access to the area is executed.

You can use the incremental mode to increase database concurrency. A transaction that uses the incremental mode does not place a lock on an area until the area is actually required for processing. This makes the area accessible to other transactions for a longer period of time. In general, if a transaction does not always access every area in its access path, you should assign the incremental mode to those areas that are least likely to be accessed.

Example

Suppose a transaction needs to access three different tables, each of which is stored in a different area:

Table

Area

Acquisition mode

T1

AREA1

Preclaim

T2

AREA2

Incremental

T3

AREA3

Preclaim

Locks would be acquired in the manner shown next:

TRANSACTION A
-------------
   .
   .
   .
SELECT * FROM T1;    ◄---------------  Locks are placed on both
   .                                     AREA1 and AREA3.
   .
   .
SELECT * FROM T2;    ◄---------------  A lock is placed on AREA2.
   .
   .
   .
SELECT * FROM T3;
   .
   .
   .