A few weeks ago I wrote about how you can Display File Usage Information to view information about what jobs are using a file within the Integrated File System. You can also view lock information from the GUI, and that too has existed since V5R1 and V5R2. For object locks, most everyone is aware of the Work with Object Locks (WRKOBJLCK) command. This blog will review how you can view object lock information from Navigator for i. You’ll discover there are a few more capabilities through the GUI than there are via the command interface.
There is a lot of functionality built into the GUI for displaying object locks as well as database member and record locks. This blog is only going to review the object lock information.
First of all, start by reviewing the locks held by a job. This is similar to working with a job (WRKJOB), option 12, Work with locks.
Once you navigate to the job you are interested in, right click to bring up the pop-up menu and go to Details then Locked Objects.
You will then be shown a list of the object locks held by the job.
For any given object that is locked, you can then display either the Lock Holders or Properties.
Lock Holders will show you other jobs that are holding locks on that object; this is similar to what WRKOBJLCK will show you.
Properties provide additional information beyond what you can find on the command interface. Specifically, on the General tab, you will see additional information about the object lock that is held. A simple example is with the job’s lock on the user profile object. On the green-screen interface, you will see the user profile object listed three times in the job’s lock list. On the GUI, you will only see the user profile listed once, but the lock detail information will show you that the object has a total of three locks on it. Note that the information on the General tab can be included in the Locked Objects table view by customizing the Columns…
The Details tab contains information regarding the procedure, module, program, statements and instruction number where the lock was obtained. The information displayed here will depend upon the actual program that obtained the lock, but this information can be invaluable for debugging locking problems.
You can get additional locking information when you take the Include… option from the work management Locked Objects action drop-down. The Include… options allow you to display additional lock information that is not shown by default; the operating system has internal locking mechanisms – locks on internal system objects as well as space location locks – you can toggle these options on to display additional locking information which can be useful for diagnostic purposes.
You can also do these functions through programmatic interfaces. There are many APIs that provide lock information:
- List Object Locks (QWCLOBJL)
- Retrieve Job Locks (QWCRJBLK)
- Retrieve Lock Information (QWCRLCKI)
- Retrieve Lock Request Information (QWCRLRQI)
- Retrieve Lock Space Attributes (QTRXRLSA)
- Retrieve Lock Space Locks (QTRXRLSL)
- Retrieve Lock Space Records (QTRXRLRL)
- Retrieve Thread Attribute (QWTRTVTA)
This blog post was edited for currency on February 19, 2020.
This blog post was originally published on IBMSystemsMag.com and is reproduced here by permission of IBM Systems Media.