Sometimes the simplest of questions that come into our support desk can fill us with dread and before the advent of IBM i Services, finding out which job had a lock on a particular IFS object was definitely one such question.
Back in the olden days we would have to write a custom program or command to make use of the QP0FPTOS API. It’s not that this required a degree in Nuclear Physics but it was time consuming and often it could take longer to get permission to write the code than to actually write the code itself.
IBM i Services to the rescue
Now that we have IBM i Services this whole process becomes child’s play. You simply find out the name of the IFS object you are interested in and put that in a simple SQL statement and you get a row back for each job that has a lock on the IFS object in question.
So, in the example below, I want to know who is editing a Stream File called “/home/rowton/script1.ftps”
select i.*
from table (
qsys2.ifs_object_lock_info(
path_name => ‘/home/rowton/script1.ftps’)
) i;
The SQL result shows me that User “Brad” using session QPADEV0004 is the culprit
What if I’m running 7.2 of IBM i or older?
This particular IBM i service is only available from 7.3 onwards. If you are still running on an older version, well my first advice is of course to upgrade to a fully supported version of this wonderful operating system but if that is not possible, try the IBM advice at the link below to create your own customer WRKLCK command:
https://www.ibm.com/support/pages/sample-program-list-lock-information-ifs-objects
i-UG goes Hybrid
We are returning to the Mount Hotel in my home town of Wolverhampton for another Hybrid event on the 6th & 7th July, we hope to see you there.
For more details check out www.i-ug.co.uk

Leave a Reply