Posted by relgert on 30-Jul-2007 09:20

How do I get an exclusive lock on a record... code is


if available dcnew then...

and in code here I try to change a value in dcnew I often get an error saying dcnew is in use by so-and so

why does this not work.

All Replies

Posted by Admin on 30-Jul-2007 10:49

Are you taking this record of a browser?

Are you using no-lock in your browser?

Posted by relgert on 30-Jul-2007 10:53

no browser I just try to update that record and I get a record is locked error

Posted by Thomas Mercer-Hursh on 30-Jul-2007 11:00

The IF AVAILABLE test isn't going to do you any good if you don't use NO-ERROR. If someone already has the record when you try to lock it, you will get the error you describe.

Posted by relgert on 30-Jul-2007 11:28

i've had no-wait no-error on it same thing.. it is going through a for each loop at this time and updates records.... typically out of 500 or so updates 1 fails because the record is in use

Posted by Thomas Mercer-Hursh on 30-Jul-2007 11:37

COMPILE with LIST to look at your transaction scoping and, if that doesn't tell you, give us a bit more of the code ... there is something you aren't telling us. If you do a FIND EXCLUSIVE NO-ERROR and the record is AVAILABLE, then you have it locked until you release it so, either you aren't getting it in the first place or the scope of that lock isn't what you think it is and you are getting the error outside that scope when, perhaps, the EXCLUSIVE has degraded to SHARE.

This thread is closed