Usage of NO–WAIT Option

Hi Everybody,
Can anyone give me where exactly NO–WAIT should be used and what is the purpose of using the same???

Thanks in advance. :)
 
NO-WAIT should be used when attempting to exclusive-lock a single record but not wanting to wait if it's already locked. It MUST be used in conjunction with NO-ERROR & does not help unless LOCKED is used subsequently. Also, LOCKED = TRUE also means AVAILABLE = FALSE, so if testing for IF NOT AVAILABLE, that includes a LOCKED record.

e.g.
FIND record EXCLUSIVE-LOCK NO-ERROR NO-WAIT.
IF LOCKED THEN DO:
processing for locked record
END.
ELSE IF NOT AVAILABLE THEN DO:
processing for non-existing record
END.
ELSE DO:
processing for existing record.
END.
 
Back
Top