The type of database locking used for Enterprise Server applications that access IMS databases is based on their access mode, which can be either exclusive or shared.
//IMSLOCK DD * (EXCLUSIVE | SHAREDGO) /*
Shared access mode is used for online programs such as IMS and CICS transactions and IMS BMPs.
Requirements
Shared access requirements are:
Locking
In shared access mode, IMS database locking occurs at the database record level. The DB record includes the root segment and all dependent segments. Secondary Index DBs lock the DB record of the target segment in the primary database. Logical relationships lock both the DB record where the logical child segment is defined and the DB record of the destination parent.
If a locked record is encountered while processing a DLI call, DB Control goes into lock retry. This retry continues until either the record lock is released or a wait time is exceeded. The wait time is controlled by environment variable:
ES_IMS_LOCK_TIMEOUT=n
Where n is expressed seconds in the range of 0-65535. The default value is 30 seconds. A value of 0 indicates to wait forever.
The lock retry algorithm can also be tuned for performance. This delay interval controls the retry frequency and can be externally controlled by environment variable:
ES_IMS_LOCK_RETRY_DELAY=n
Where n is expressed in milliseconds in the range of 0-65535. The default retry delay is 5 milliseconds.
When a lock wait period expires, a BD status code is returned to the DLI call and an error message written to the server console. It is not normal to have lock wait times expire; these should be researched. Possible causes for wait expirations are when an application holding locks is waiting on resources from another resource manager or suspended for some other reason. These can also happen when a system has become CPU starved due to other machine activity resulting in pausing of the application. This can be rectified by increasing the lock timeout value.
To help diagnose lock timeout issues, the following environment variable triggers a system dump when a timeout is detected:
ES_IMS_DUMP_ON_TIMEOUT=1
Shared access databases can use one of two locking modes: traditional or IRLM. The locking mode is defined to IMS DB Control at Enterprise Server startup.