Have you ever wanted to be able to determine who is locking an object in the IFS? In this installment of APIs by Example, Carsten Flensburg shows you how!
The DSPIFSLCK utility uses the "Retrieve Object References (QP0LROR)" API to list the jobs that are locking an object in the IFS. V5R2 is required in order to use this API.
Here's what the screen for the DSPIFSLCK command looks like:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Display IFS Object Locks (DSPIFSLCK)
Type choices, press Enter.
IFS object . . . . . . . . . . .
Output . . . . . . . . . . . . . * *, *PRINT
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
When you run this utility, it will produce a spooled file that can either be printed or displayed on the screen. Here's a sample of how the output appears when you display it on the screen:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Display Spooled File
File . . . . . : QSYSPRT Page/Line 1/2
Control . . . . . Columns 1 - 78
Find . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7
3/21/04 15:40:35 Display IFS object locks
IFS object . . . : /home/klemscot/myfile.csv
Object in use . : *YES
Check out user . : *NONE
------
Job name Job user Job nbr Rd only Wr only Rd/wr Exec Rd onl
QPADEV0007 QSECOFR 524999 1 0 0 0 0
QPADEV000R STRAPENN 524995 1 0 0 0 0
QPADEV0008 KLEMSCOT 524989 2 0 0 0 0
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
The following APIs are demonstrated in the DSPIFSLCK utility:
Retrieve Object References (QP0LROR) http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qp0lror.htm [1]
Get File or Link Information (QlgStat) http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/lstatu.htm [2]
Retrieve Identity of Last Spooled File Created (QSPRILSP) http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/QSPRILSP.htm [3]
Retrieve Job Information (QUSRJOBI) http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qusrjobi.htm [4]
Send Program Message (QMHSNDPM) http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/QMHSNDPM.htm [5]
The following ILE C runtime function is demonstrated in the DSKIFSLCK utility:
System() -- Execute a Command http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c415607107.htm#HDRSYSTEM [6]
The DSPIFSLCK utility requires V5R2 to execute properly. You can retrieve the source code for this utility from: http://www.iseriesnetwork.com/noderesources/code/clubtechcode/DspIfsLck.zip [7]
The above source code was written by Carsten Flensburg. For questions regarding this tip, contact Carsten at mailto:flensburg@novasol.dk [8]
Links:
[1] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qp0lror.htm
[2] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/lstatu.htm
[3] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/QSPRILSP.htm
[4] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qusrjobi.htm
[5] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/QMHSNDPM.htm
[6] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c415607107.htm#HDRSYSTEM
[7] http://www.iseriesnetwork.com/noderesources/code/clubtechcode/DspIfsLck.zip
[8] mailto:flensburg@novasol.dk