Approach seems a little dangerous to me, but if you are sure you are not going to accidentally kill jobs that have a genuine lock, read on.

The QSYS2.OBJECT_LOCK_INFO SQL view will show you locks on an object. You can find some code that uses it here:
https://github.com/SJLennon/IBM-i-RPG-Free-CLP-Code/tree/master/APIs_SQL

If you are on a really old release that doesn't have the SQL view, there is similar code that uses APIs to find the locks here:
https://github.com/SJLennon/IBM-i-RPG-Free-CLP-Code/tree/master/APIs

You can probably adjust the code to do whatever you want.

Sam



On 6/14/2025 9:15 AM, john art wrote:
We have some RPG programs to menage a B2B site; some times happend, for lost connection or other situation, that the web connection go down, but the Ibm i job remains active and with him also some record locks, so when the user try reconnect , receive error “record already allocated by another job”. I was looking for an example that in this case , let to the rpg program , when receive that error (“record already allocated by another job”), to automatically kill the job that locks the record.
Thanks in advance
P.S. also other suggestions are welcome




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.