× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2024 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.