The direct way, from the command line:
WRKOBJLCK OBJ(PRODLIB/ITEMS) OBJTYPE(*FILE)
The same in SQL, useful when the result has to be collected in a program or several objects looked at together:
SELECT JOB_NAME, LOCK_STATE, LOCK_STATUS, LOCK_SCOPE
FROM QSYS2.OBJECT_LOCK_INFO
WHERE SYSTEM_OBJECT_SCHEMA = 'PRODLIB'
AND SYSTEM_OBJECT_NAME = 'ITEMS'
For database file members the lock can be on the individual member:
WRKOBJLCK OBJ(PRODLIB/ITEMS) OBJTYPE(*FILE) MBR(*ALL)
Note
a lock held by an interactive session is almost always a transaction left open,
not a fault. Ask before ending the job: closing it with ENDJOB while a transaction is
open leaves the work half done and forces a recovery.
Releases. WRKOBJLCK exists on any release. The QSYS2.OBJECT_LOCK_INFO view is more
recent and arrived with IBM i Services: if it is missing the query answers SQL0204, and the
command remains, giving the same information on screen.
Comments
No comments yet. Be the first to comment!
You need an account to comment. Log in · Sign up