Perhaps we should apply a little Systems Analysis 101 here - ask some questions. I'm not convinced that the original request completely described the need.

What is the logical scenario (batch update, transaction entry, file maintenance, etc.)? Once a lock is removed, do you want your copy of the record to be written regardless of why it was locked in the first place, possibly overwriting someone else's changes?
Why do you want to do it this way?

I'm sure there are other questions, but these will do for a start. If, as Will suggested, this is a job application test, the OP should answer that more information is needed. Technically, what was described is completely doable, but is it the correct thing to do?

Charlie Noah

Tiny Bear's Wild Bird Store
Home of "Safety Net Shipping"
Toll Free: 1-855-TinyBear (855-846-9232)

On 02-07-2013 2:26 AM, Mecki Foerthmann wrote:
The READU statement has a LOCKED clause that is true if a record is locked.
You can put all your locking ha logic in there.
READU record FROM filevariable,itemID THEN
   code if record exists and isn't locked (optional)
   code to handle locked record condition (optional)
   code if record doesn't exist (required)

Now if you put that into a loop you can display a message and give the user the option to try again or abort. And if you put the code into a subroutine you can use that in all your programs with a single line like this.
CALL SR.READU(record,filevariable,ItemID,Option,Err)

On 06/02/2013 21:52, Jon Wells wrote:
Hi all,

I have not looked at the world of record locks since my R83 Pick days. I'm hoping to add the ability for the program I'm working on to:

    * Check if a record is locked
    * Wait until the lock is removed
    * Once the lock is removed, or if the record is not locked:
    * Lock the record
    * Perform the WRITE statement
I'm hoping someone can share an example of how to accomplish this in UniBasic.

Thank you,

Jon Wells
Campbell University
U2-Users mailing list

U2-Users mailing list

U2-Users mailing list

Reply via email to