If you read a record in an update capable file, it will be locked assuming you don't use the no-lock extender.
Another process trying to read that record will wait until the timeout (WAITRCD value on the file) and then throw a message. Of course, you can monitor for that in the program.
You'd probably want to have a short RCDWAIT value - default is 30 seconds, I believe. DSPFD will tell you.
I *think* this addresses your concerns?
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of James H. H. Lampert
Sent: Wednesday, October 17, 2018 5:03 PM
To: RPG programming on the IBM i / System i
Subject: Exclusive locks at the record level?
I've got a project, where I'd like to have a bunch of parallel batch
jobs behaving thusly:
All of them are running through the records of a file, in RPG, executing
"process x" (involving a single-record web service that takes time to
process the record it's fed, apparently well beyond the time needed to
transport the data) upon them.
I know we have exclusive locks at the file level, but I can't remember
whether or not we have it at the record level, in a form that can be
used in RPG, with native record-level access.
It would be nice for each of these parallel jobs to be able to simply
grab the next record that isn't already done, and isn't already being
processed by a sister job.
This mailing list archive is Copyright 1997-2019 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