Issue

Some process fails trying to update an IFS object that is not available.  We need to see what job is holding the object lock, but there is no equivalent to the WRKOBJLCK command for IFS files.  This article tells how to use the QP0FPTOS API to find locks for IFS files.

Environment

Zend Server for IBM i 2020.x and higher (for Zend Server 9.1x - 2019.x please replace all instances of zendphp74 with zendphp7; for Zend Server 6 - 8.5.x please replace all instances of zendphp7 with zendsvr6)

Resolution

To find any locks on an IFS object, please run the following 5250 command with QSECOFR or any profile with *SERVICE special authority:

CALL PGM(QP0FPTOS) PARM(*LSTOBJREF '/path/to/your/file' *FORMAT2) 

Please substitute the actual path for the file you are interested in. This command will produce a spool file that will tell any locks held for the file.

For example, when it is running, the ZENDSVR6 Apache instance will have several jobs holding locks on file /usr/local/zendsvr6/bin/php-cgi.bin, the PHP engine.  You can see these locks by running this command:

CALL PGM(QP0FPTOS) PARM(*LSTOBJREF '/usr/local/zendphp74/bin/php-cgi.bin' *FORMAT2) 

After the command runs, you will see this message:

The dump request has completed. The latest spooled file QSYSPRT with
label QP0FDUMP has the dump.

Here are partial contents of the spool file output:

List Object References (QP0FPTOS *LSTOBJREF *FORMAT2)
5770SS1 V7R3M0 100423 I71SUP3 Fri Oct 3 10:55:10 2014
Object . . . . . . . . . . . : /usr/local/zendphp74/bin/php-cgi.bin
Use Count . . . . . . . . . : 1
The object does have references.
Number of jobs . . . . . . . : 11
Number of jobs available . . : 11
Simple Reference Types (# of references):
Read Only 1
Write Only 0
Read/Write 0
Execute 1
Share with Readers Only 1
Share with Writers Only 0
Share with Readers and Writers 0
Share with neither Readers nor Writers 0
Attribute Lock 0
Save Lock 0
Internal Save Lock 0
Link Changes Lock 0
Checked Out 0
Extended Reference Types (# of job's with references):
Read Only, Share with Readers Only 0
Read Only, Share with Writers Only 0
Read Only, Share with Readers and Writers 0
Read Only, Share with neither Readers nor Writers 0
Write Only, Share with Readers Only 0
Write Only, Share with Writers Only 0
Write Only, Share with Readers and Writers 0
Write Only, Share with neither Readers nor Writers 0
Read/Write, Share with Readers Only 0
Read/Write, Share with Writers Only 0
Read/Write, Share with Readers and Writers 0
Read/Write, Share with neither Readers nor Writers 0
Execute, Share with Readers Only 11
Execute, Share with Writers Only 0
Execute, Share with Readers and Writers 0
Execute, Share with neither Readers nor Writers 0
Execute/Read Only, Share with Readers Only 0
Execute/Read Only, Share with Writers Only 0
Execute/Read Only, Share with Readers and Writers 0
Execute/Read Only, Share with neither Readers nor Writers 0
Attribute Lock 0
Save Lock 0
Internal Save Lock 0
Link Changes Lock 0
Current Directory 0
Root Directory 0
File Server Reference 0
File Server Working Directory 0
Checked Out 0
NFS Server Reference 0
Jobs using the object:
------------------------------------------------------------------------------
Job. . . . . . . . . . . . . : 021464/QTMHHTTP/ZENDPHP74
Simple Reference Types (# of references in this job)
Read Only 0
Write Only 0
Read/Write 0
Execute 1
Share with Readers Only 1
Share with Writers Only 0
Share with Readers and Writers 0
Share with neither Readers nor Writers 0
Attribute Lock 0
Save Lock 0
Internal Save Lock 0
Link Changes Lock 0
Checked Out 0
Extended Reference Types (# of references in this job)
Read Only, Share with Readers Only 0
Read Only, Share with Writers Only 0
Read Only, Share with Readers and Writers 0
Read Only, Share with neither Readers nor Writers 0
Write Only, Share with Readers Only 0
Write Only, Share with Writers Only 0
Write Only, Share with Readers and Writers 0
Write Only, Share with neither Readers nor Writers 0
Read/Write, Share with Readers Only 0
Read/Write, Share with Writers Only 0
Read/Write, Share with Readers and Writers 0
Read/Write, Share with neither Readers nor Writers 0
Execute, Share with Readers Only 1
Execute, Share with Writers Only 0
Execute, Share with Readers and Writers 0
Execute, Share with neither Readers nor Writers 0
Execute/Read Only, Share with Readers Only 0
Execute/Read Only, Share with Writers Only 0
Execute/Read Only, Share with Readers and Writers 0
Execute/Read Only, Share with neither Readers nor Writers 0
Attribute Lock 0
Save Lock 0
Internal Save Lock 0
Link Changes Lock 0
Current Directory 0
Root Directory 0
File Server Reference 0
File Server Working Directory 0
Checked Out 0
NFS Server Reference 0
------------------------------------------------------------------------------
Job. . . . . . . . . . . . . : 021463/QTMHHTTP/ZENDPHP74
Simple Reference Types (# of references in this job)
Read Only 0
Write Only 0
Read/Write 0
Execute 1
Share with Readers Only 1
Share with Writers Only 0
Share with Readers and Writers 0
Share with neither Readers nor Writers 0
Attribute Lock 0
Save Lock 0
Internal Save Lock 0

And so on.  You see a summary of the locks, then a listing for each job.