Yes there is an IBM API program for this:
CALL QP0FPTOS PARM(*LSTOBJREF ‘/ifspath/ifsfile’ *FORMAT2)
It will produce a detailed spooled file report with all the jobs that have a lock on that IFS object and the type of lock they have.
You probably want the Retrieve Object References (QP0LROR) API. I think IBM first supplied decent documentation in V5R4: <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apis/qp0lror.htm”>Retrieve Object References (QP0LROR) API</a>
It’s not trivial. I think I can supply an ILE CL example. (If you can read CL, you ought to be able to convert to any other language.)