× 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.



I agree with Buck. I will do a CHAIN(n) for on-line maintenance so that the lock doesn't hang some other production job, but always check to see if the record has changed after during the straight CHAIN (Before and After images). If it has changed, say, "Sorry, you took too long. Try again."


For batch jobs, though, I just do the straight CHAIN because I know the record will be released in, say, 2 microseconds; my timeout variable is longer than that.


But Mike said he had a "read". As long as he's checking for eof or (strange thought) not accessing the same table again for some reason, he shouldn't get the "tried update before record retrieved" error. So, on the surface, it would appear that one of those things is (or is not) being done.


        * Jerry C. Adams
*IBM System i5/iSeries Programmer/Analyst
B&W Wholesale Distributors, Inc.* *
voice
        615.995.7024
fax
        615.995.1201
email
        jerry@xxxxxxxxxxxxxxx <mailto:jerry@xxxxxxxxxxxxxxx>



Buck wrote:

Make the chain a chain with an (n) no-lock extender. Then, chain again at the time of updating. If you have several lines of intervening code, as you have here, someone someday will mess it up and it will be a bear to find the problem.

Ooohh danger! There's nothing wrong with this advice as long as you're aware that the contents of the record may have changed in the interim (by some other job.)

chain()
 (credit score = 800)
...
time passes
...
a different job changes the record -- remember, it wasn't locked! The credit score in the file is now 100.
...
if credit score > 700...
  (this asserts TRUE, despite the actual value being 100)

chain
(at this moment, the credit score value field in the RPG program is changed to 100. That might be a problem, since a bunch of calculations were based on the assertion that the credit score was high.)

Often, when doing a CHAIN(N), then a long running set of operations (like EXFMT) you need to re-evaluate the contents of the record when doing the CHAIN for update. Either that, or have some sort of comparison to be sure the record is really the same both times you CHAIN.
  --buck


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-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.