the SQL view RECORD_LOCK_INFO could be a starting point ...
Paul
________________________________
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Mark Waterbury <mark.s.waterbury@xxxxxxxxxxxxx>
Sent: Friday, June 28, 2019 7:23 PM
To: Midrange Systems Technical Discussion
Subject: Re: Finding offending RPG program causing locks on files
Matt,
This happens because (stupid) RPG locks each record when read from an update-capable file, until either another record is read, or you do the corresponding UPDATE or DELETE of that record. This is called "Record locks".
There are several well-known techniques -- called "lock-free" processing, where you change the logic to issue the READ without a lock, into a data structure, then you present the screen to the user, let them make any changes, and when they press Enter, you then you re-read the record again, this time with a record lock, into another data structure, and you compare the old DS to the new DS to detect if anyone else changed that record in the meantime. If no other changes are detected, you go ahead and issue the UPDATE or DELETE. Otherwise, you give the user a message like:
Sorry, someone else has updated that record, please try again ...
and some F-key to let them re-try.
See:
https://www.mcpressonline.com/programming/rpg/avoid-record-lock-errors
and
https://www.mcpressonline.com/programming/rpg/techtip-preventing-record-lock-part-1
and
https://www.mcpressonline.com/programming/rpg/techtip-preventing-record-lock-part-2
Or, convert the RPG update programs to use embedded SQL to update only the columns (fields) changed by the user.
Hope that helps,
Mark S. Waterbury
On Friday, June 28, 2019, 12:42:21 PM EDT, Matt Olson <Matt.Olson@xxxxxxxx> wrote:
Is there a deadlock monitoring system built into DB2 like there is in SQL Server?
If so how do you enable it or view it?
We are finding some RPG programs that are maintaining exclusive locks on files for as long as you are in the screen, which then causes our end users of our website to not be able to login as the web program can't read their record. This exhibits itself in an not very helpful message of "[57014] [IBM][AS] Resource error - SQLSTATE 57014, SQLCODE -1044."
We have already fixed one RPG program which has helped the situation, but there appears to be more RPG screens doing this.
I'm wondering what the best strategy is for finding these RPG programs as the locks are released when they close out and we might not be able to do a WRKOBJLCK command in time on the four potential files that are typically required to login.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.