APIs by Example.
In “APIs by Example: Working with IFS Object Locks,” I discussed the options to identify jobs that are currently locking or accessing a specific object in the IFS. Likewise, you sometimes need to determine which IFS objects a specific job is locking or accessing. For objects in the QSYS.LIB file system,there are a couple of ways to accomplish this: use either the Display Job (DSPJOB) or the Work with Job (WRKJOB) command and specify OPTION(*JOBLCK) to display a list of QSYS.LIB objects currently locked by the job in question. To retrieve IFS object lock and access information, you can use the IBM Navigator for i GUI option or the Retrieve Referenced Objects (QP0LRRO) API.
In this article, I demonstrate how to code the QP0LRRO API and, to add a useful angle to that endeavor, present a Work with Job IFS Object Locks (WRKJOBIFSL) CL command based on QP0LRRO. (For a list of the source files and instructions for compiling this command, see the “How to Compile” box.) Using the WRKJOBIFSL together with the Work with IFS Object Locks (WRKIFSLCK) command included in the previously mentioned article will further equip you to investigate and handle IFS object locks. In doing so, you’ll also learn how resource access in the IFS is controlled and IFS object integrity is enforced.
QP0LRRO API’s Required Parameters
As with the QP0LROR API that I discussed in last month’s article, the QP0LRRO API documentation in the IBM Information Center presents the API interface in C notation. Transforming the specifications into a fully functional RPG IV prototype requires a little work from the RPG programmer. If at some point you encounter a similar challenge when trying to code an API, a great resource to help you overcome possible obstacles is the article “Converting from C Prototypes to RPG Prototypes” by IBM’s Barbara Morris (just follow the link in the “Find Out More” box).