We are getting away from platform specific SQL code and have moved on to ORM's rather then thousands of lines of SQL spread throughout our programs. Injecting a platform specific code into hundreds of methods to track something that the database platform should be doing is not a path I want to explore.
It looks like this link is more likely something I would want. I wonder if the that lock detection thing is what the QSYS2.RECORD_LOCK_INFO view is doing under the covers. Unfortunately when I issue the following SQL it never returns any data. Been running for about over 3 minutes now without returning lock details:
SELECT * FROM QSYS2.RECORD_LOCK_INFO
Is anyone able to successfully execute that SQL statement?
-----Original Message-----
From: Mark Waterbury <mark.s.waterbury@xxxxxxxxxxxxx>
Sent: Friday, June 28, 2019 1:03 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Finding offending RPG program causing locks on files
Matt,
Here is a more modern approach:
https://www.mcpressonline.com/analytics-cognitive/db2/techtip-add-lock-detection-to-your-db2-for-i-arsenal
Hope that helps,
Mark S. Waterbury
On Friday, June 28, 2019, 1:31:53 PM EDT, Matt Olson <Matt.Olson@xxxxxxxx> wrote:
Yeah we know how to fix it, the trouble is finding all the programs that are causing it. That is what I'm looking for a solution on.
Right now I have a loop in our web application continually reading a record, and trying every option in every screen looking for when my web application bombs.
Not very efficient...
-----Original Message-----
From: Mark Waterbury <mark.s.waterbury@xxxxxxxxxxxxx>
Sent: Friday, June 28, 2019 12:23 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
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
--
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.