|
On Aug 25, 2016, at 1:32 PM, Bob Cagle <bcagle@xxxxxxxxxxx> wrote:
Yes, maybe I shouldn't have said 'native'. I'm perfectly fine with accessing either a CLLE or another service program to access the function. I was just curious if there was a %BIF or RPG opcode that I was missing - doesn't sound like it though.
The reason for wanting to attempt the lock is I have a process that cannot run while another process is running. This other process puts a lock on a specific data area. I just need to check if that data area is locked or not before allowing my process to continue.
-----Original Message-----
From: Mark S Waterbury
Bob:
What do you mean by "native"? On OS/400 and IBM i, you can not get much more "native" than invoking MI (machine interface) instructions directly from within ILE programs as built-in functions.
What kind(s) of object type(s) are you wanting to "lock"? And for what purpose(s)?
Here is one way to accomplish this:
Create a CLP *PGM or CLLE procedure you can call from RPG, that issues the ALCOBJ command to "lock" an object, and uses MONMSG CPF1002 to detect if the object could not be allocated; specify WAIT(0) on the ALCOBJ command so it does not wait for the lock, but if the object cannot immediately be "allocated" (locked), the command signals an exception by throwing an *ESCAPE message CPF1002. Then, your CL program or procedure can return some kind of "return code" to indicate success or failure.
IMHO, using CL commands and a CLP program or CLLE program or procedure in this way is still considered "native." :-)
HTH,
Mark S.Waterbury
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.