Sorry Mecki but I think you have the LOCKED in the wrong place.  At
least in my version of Unidata.  It comes before the THEN segment so the
full, proper syntax would be:

READU xxx FROM xxx, xxx ON ERROR
  Xxx what to do if a hard error like file not open
END LOCKED
  Xxx what to do if locked
END THEN
  Xxx what to do if lock is obtained and record is read
END ELSE
  Xxx what to do if lock is obtained but record does not exist.
END

There is a second format for the READU command but it's a lot easier if
the OP just reads about, himself, in the HELP information.  HELP
UNIBASIC READU from ECL in Unidata will get him that.

 

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Mecki
Foerthmann
Sent: Thursday, February 07, 2013 12:27 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Record locks (Unidata 7.2)

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) LOCKED
    code to handle locked record condition (optional) END ELSE
    code if record doesn't exist (required) END

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@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to