OPER W DB shows Locks Requested greater than the LOCK LIMIT but task is not abended


Article ID: 205834


Updated On:




We have Lock Limits set but for a particular task OPER W DB shows Locks Requested higher than the set Limit.

Why is the task not abended for exceeding Lock Limit?


Lock Limits are not enforced on the number of locks Requested throughout the execution of the task.

They are enforced based on the number of locks HELD at any point during execution.


From System Generation SYSTEM Statement Parameters Information
Limits the number of record locks that a transaction can concurrently hold. When LOCK is specified, limit-n must be an integer in the range 0 through 2,147,483,647."
Also In the System Generation section on Database Locks
"LOCK LIMIT specifies the maximum number of database locks that can be concurrently held by a transaction. "
Locks Requested will typically be much higher than the number of locks held because doing a FIND/OBTAIN when the area is readied Update (or for area readied Retrieval if sysgen specifies RETRIEVAL LOCK) requests a Shared Lock.  As soon as the record currency changes to another record occurrence the SHR lock on the prior record is released.
Update locks are held until COMMIT/FINISH so a task/program that does many updates without COMMITs could amass enough locks to exceed the Lock Limit.

Additional Information

System Statement Parameter info 

Database Locks