DO FOR updOrder-line TRANSACTION

bienphong

New Member
DO FOR updOrder-line TRANSACTION:
FIND updOrder-line WHERE ROWID(updOrder-line) = ROWID(order-line) EXCLUSIVE-LOCK NO-ERROR.
updOrder-line.qty = updOrder-line.qty + 5.
END.
DO FOR updItem TRANSACTION:
FIND updITEM WHERE updITEM.item-num = order-line.item-num EXCLUSIVE-LOCK NO-ERROR.
updITEM.allocated = updITEM.allocated - 5.
END.
 

Cringer

ProgressTalk.com Moderator
Staff member
Do you have a question, or are you just posting random code snippets?
 

TomBascom

Curmudgeon
In the absence of an actual question I do have a comment to share ;)

Generally speaking... in real code you should not suppress errors with NO-ERROR and then fail to test for and handle those errors that you are ignoring. A point that I probably forget to mention often enough when I share snippets as above.

For instance, in the code above, it is possible that someone in another session deleted the record in the period between whenever "order-line" was found (presumably with NO-LOCK) and when you get around to EXCLUSIVE-LOCK ing it.
 
Top