Lesson 173 of 288
Object & Library ManagementHandling Object Locks as a Developer
Deciding what to do once you have confirmed another job is holding an object lock you need released.
Learning Objective
By the end of this lesson, you will be able to decide what to do once you have confirmed another job is holding an object lock you need released.
Simple Explanation
The Object Locks Basics lesson covered using WRKOBJLCK to see what is
locking an object. Once you know which job holds the lock, a developer
generally has a few practical options, roughly in order of how
disruptive they are:
- Wait. If the other job is expected to finish soon, such as a short batch job nearly done, simply waiting and checking again is often the simplest option.
- Ask. If the other job belongs to a specific person, such as a developer still testing something interactively, asking them directly to finish up or sign off is often faster than any technical step.
- End the job, carefully. As a last resort, ending the job holding the lock releases it, but this should be done cautiously, since it interrupts whatever that job was actually doing, potentially leaving its own work incomplete.
Why It Matters
Knowing WRKOBJLCK exists is only half the picture; knowing what to
actually do once you have identified the blocking job is what turns that
information into a resolved problem. Jumping straight to ending another
job without first considering waiting or simply asking can cause more
disruption than the original problem itself.
Practical Example
Imagine needing to recompile CUSTRPT while WRKOBJLCK shows another
developer's interactive job currently has it locked, actively testing
changes. Rather than ending their job outright, a quick message asking
them to sign off once they finish testing resolves the situation without
losing any of their in-progress work. If instead the lock belonged to an
unattended batch job nearly finished, simply waiting a few minutes and
checking again might be the more sensible choice.
This is a simplified, illustrative example rather than a specific real investigation, but it reflects a realistic, practical decision process developers actually go through.
Common Confusions
"Is ending the job holding a lock always the fastest way to resolve it?" Technically the most immediate, but not always the best choice; it interrupts whatever that job was doing, which could cause its own problems. Waiting or simply asking are often better first choices when reasonably possible.
"Can I tell from WRKOBJLCK alone whether it's safe to end the job
holding the lock?"
Not entirely on its own; WRKOBJLCK shows which job holds a lock, but
deciding whether ending it is safe generally requires understanding what
that specific job is actually doing, which may require checking further,
such as its job log or asking whoever is running it.
"Does releasing an object lock this way happen automatically once the other job finishes normally?" Yes. If the other job simply finishes or signs off normally, its object locks release on their own; the wait-ask-end progression covered in this lesson matters specifically when that job is not finishing on its own in a reasonable time.
Quick Recap
- Once
WRKOBJLCKidentifies the job holding a lock, practical options generally range from waiting, to asking the job's owner, to ending the job as a last resort. - Waiting or asking are often better first choices than ending a job outright, since ending a job interrupts whatever it was doing.
- Deciding whether ending a job is safe generally requires understanding what that job is actually doing, not just that it holds a lock.
- Object locks release automatically once the job holding them finishes or signs off normally.
Try Asking the AI Tutor
Use the AI Tutor to ask follow-up questions about this lesson. For example, try asking:
- "What information would help me decide whether it's safe to end a job holding a lock I need released?"
- "Is there a way to be notified automatically once a lock is released, instead of repeatedly checking WRKOBJLCK?"