So, your nightly backup or other important job is running and BOOM, a message arrives on the QSYSOPR message queue that the job has encountered a record allocation or object allocation error, because some other job is holding a lock on the record or the object you need. You do a WRKOBJLCK (Work with Object Locks) command to see who has it, and send the offending user a message or terminate the offending job so the important job can run.
The following command will do all this for you. The Process Object Locks (PRCOBJLCK) command identifies all jobs currently holding a lock for the specified object. For each job, it either sends a break message or ends the job. The break message is sent to the jobs holding the lock or optionally to all jobs currently running under the user profile of the jobs holding the lock.
Download the save file containing the source code.