OK, I downloaded, compiled and ran the code. Brings back nightmares from long ago. MOVEA to set groups of indicators, brrrr!

Anyway, I commented the UNLOCKS out and saw the (or better: a) problem: if I select 2, just press enter without changing anything the record is not updated and not unlocked, so there’s your record lock.

Basic problem is that you make no distinction in your between database fields and screen fields. And thus in subroutine CHGREC you do a CHAIN, then an EXFMT, then some checks and if all the checks are OK you do the update. But if not all checks are OK, you leave. And so you leave unfinished business, the locked record.

If you would make a distinction between database and screen fields you could do a CHAIN without lock, move database fields to screen fields, do the EXFMT and all the checks. And if all the checks are OK, then you do a CHAIN with lock, move the screen fields to the database fields and then do the UPDATE. No need for UNLOCK then.

Joep Beckeringh

Op 23 feb. 2022, om 15:57 heeft Patrik Schindler <poc@xxxxxxxxxx> het volgende geschreven:

Hello Joep & Charles,

Am 23.02.2022 um 15:06 schrieb Joep Beckeringh via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx>:

In 35 years of coding RPG I have never seen this happen; with or without commitment control. Whenever we found a problem with a record being locked, it always turned out to be an error in the code.

I suggest you remove the UNLOCKs and try to find out what really was the problem.

Been there, done that. Have no idea. The lock is removed only after another record is locked from

If you want to try yourself, source code is here: https://github.com/PoC-dev/as400-sfltemplates-german

I signed on twice, started the program, and put up the edit screen on one record. When trying to do the same with the second signon, with the same record, I got a "record already locked" error. That's when I added the UNLOCKs.

:wq! PoC



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