IBM Support

Diagnosing a Lock Wait(LCKW) Condition

Troubleshooting


Problem

Job(s) is waiting to get a lock on an object. The status of the job is Lock Wait(LCKW).  

Symptom

Job(s) remain in a Lock Wait(LCKW) status. This condition can cause delays in processing transactions, data updates and unexpected long wait times.

Cause

A lock wait condition occurs when a job attempts to obtain a lock on a resource that is already held by job on the system.  When the duration of the lock wait time is extended, this results in a slow down of processing of transactions or other activities. 
There is no flight recorder that keeps track of lock information on the system. Data must be collected at the time of the lock condition. 

Diagnosing The Problem

How to diagnose:
Method 1: WRKJOB Command.
  • Use the command WRKJOB to display information about the job in a LCKW status, use option  12. Work with locks, if active, to display lock information.  
                                                             System:   RCH730A  
 Job:   QPADEV0014     User:   V6CASTIL       Number:   192284                  
                                                                                
 Job status:   ACTIVE                                                           
                                                                                
 Type options, press Enter.                                                     
   5=Work with job member locks   8=Work with object locks                      
                                                                                
                              Object                      Member  ASP           
 Opt  Object      Library     Type       Lock     Status  Locks   Device        
      AUTFAIL     V6CASTIL    *FILE-PHY  *SHRRD    REQ     WAIT                 
      LEVEL2      QSYS        *USRPRF    *SHRRD    HELD                         
                                         *SHRRD    HELD                         
                                         *SHRRD    HELD        
                
  • View the list of locked objects for the job to determine which object the job is waiting to get a lock on. Then use the Lock Holders action against the object to determine which job already holds the lock. You then need to determine why this job is holding the lock, and what can be done to release the lock.
Method 2: Joblog Messages.
  • Use the command WRKJOB to display information about the job in a LCKW status, use option  10. Display job log, if active, on job queue, or pending
  • Review the messages in the joblog, the messages listed indicating that a lock operation can not completed, can contain information about the job holding the lock. 
   
                       Display Formatted Message Text                         
                                                           System:   RCH730A  
essage ID . . . . . . . . . :   MCH5804                                       
essage file . . . . . . . . :   QCPFMSG                                       
 Library  . . . . . . . . . :     QSYS                                        
                                                                              
essage . . . . :   Lock space location operation not satisfied in specified   
 time interval.                                                               
ause . . . . . :   A specified time interval of &2 seconds has elapsed and a  
 Lock Space Location or Lock Teraspace Storage Location has not been          
 satisfied. The lock holder type is &3. The lock holder name is &4. The lock  
 holder thread identifier is &5.                                              
   The lock holder type has the following meaning:                            
   0 - The lock holder is a Licensed Internal Code (LIC) task.  The lock      
 holder name and thread identifier do not apply.                              
   1 - The lock holder is a job.                                              
   2 - The lock holder is a transaction control structure.  The lock holder   
 name and thread identifier do not apply.                                     
                                                                              
NOTE: On the previous sample error messages, it contains information about the job holding the lock.  You then need to determine why this job is holding the lock, and what can be done to release the lock.
Method 3: WRKOBJLCK command.
  • If the name of the locked object is known, use the command WRKOBJLCK to display lock information for the object:
                             Work with Object Locks                             
                                                             System:   RCH730A  
 Object . . . . :   AUTFAIL               Type . . . . . :   *FILE-PHY          
   Library  . . :     V6CASTIL            ASP device . . :   *SYSBAS            
                                                                                
 Type options, press Enter.                                                     
   4=End job   5=Work with job   8=Work with job locks                          
                                                                                
 Opt   Job          User         Lock      Status          Scope     Thread     
       QPADEV0005   V6CASTIL     *SHRRD     HELD           *JOB                 
                                                                                
NOTE: On the WRKOBJLCK command use the option 5=Work with job to determine why this job is holding the lock, and what can be done to release the lock.
Method 4: Using the QSYS2.ACTIVE_JOB_INFO SQL Service: 
  • Run the following SQL to display the last 5 messages for all Interactive and Batch jobs in a LCKW status:
SELECT MESSAGE_TIMESTAMP,
       JOB_NAME,
       JOB_STATUS,
       MESSAGE_ID,
       MESSAGE_TYPE,
       MESSAGE_TEXT
    FROM TABLE (
             QSYS2.ACTIVE_JOB_INFO(JOB_NAME_FILTER => '*ALL')
         ) T1
         CROSS JOIN LATERAL (
                 SELECT *
                     FROM TABLE (
                             QSYS2.JOBLOG_INFO(JOB_NAME)
                         )
                     WHERE MESSAGE_TYPE IS DISTINCT FROM 'REQUEST'
                     ORDER BY ORDINAL_POSITION DESC
                     FETCH FIRST 5 ROWS ONLY
             )
    WHERE JOB_TYPE IN ('INT', 'BCH', 'PJ'))
          AND JOB_STATUS IN ('LCKW')
image-20250611111317-1
Method 5: Advanced Analysis command SERVICEDOCS.
  • Use the Advanced Analysis SERVICEDOCS collection to collect information about the lock condition.  
  • Follow the steps on the following link:
    • MustGather:  Data to collect for a Hung Job - SERVICEDOCS
      • https://www.ibm.com/support/pages/node/635533
NOTE: On Step 8. specify -lock for object lock issues or -lockd for database record lock issues.
NOTE 2: Send the data collected by this command to your IBM Support Case.
Method 6: Job Status Trap.
  • If the lock condition occurs while you are not active on the system, you could ahead of time, setup a Lock Wait status trap.  If a locking condition occurs, the OS, will collect information automatically. 
  • Follow the steps on the following link under section Job Status Trap:
NOTE: Send the data collected by this command to your IBM Support Case.
Method 7: Job Watcher data. 
NOTE: Send the data collected by this command to your IBM Support Case.

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHAAA2","label":"Operating System"}],"ARM Case Number":"TS017209751","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.3.0;7.4.0;7.5.0;7.6.0"}]

Document Information

Modified date:
22 October 2025

UID

ibm17168509