Consultor Eletrônico



Kbase P172731: Application stops when user presses Cancel button on error 2624 dialog box
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   02/09/2010
Status: Unverified

SYMPTOM(s):

Application stops when user presses Cancel button on error 2624 dialog box

Application stops when user presses Cancel button on Database Status dialog box

Application stops when user presses Cancel button when record is locked by another user.

<file-name> in use by <user> on <tty>. Wait or choose CANCEL to stop. (2624)

FACT(s) (Environment):

No DO TRANSACTION or REPEAT block around statement accessing the locked record.
No ON STOP phrase is used.
All Supported Operating Systems
Progress/OpenEdge Product Family

CAUSE:

This is expected behavior. Pressing the Cancel button raises the STOP condition, which by default stops all processing if there is no transaction to undo and the STOP condition is not trapped.

FIX:

The STOP condition can be trapped by placing code that might access a locked record within a DO or REPEAT block with the ON STOP phrase. The ON STOP phrase can specify LEAVE, NEXT, RETRY (the default), or RETURN as the action to take after undoing any active transaction.
Alternatively, a FOR, FIND, or GET statement (or the equivalent query handle method for dynamic queries) can handle locked records in such a way that error 2624 is avoided. This can be done by:

Using the NO-WAIT phrase to return immediately if the record cannot be accessed because it is locked by another user.
On the FIND statement, using the NO-ERROR phrase, and checking whether the record was locked using the AVAILABLE and LOCKED functions.
Error 2624 can also be avoided by coding applications so the amount of time records are locked with exclusive locks is minimized. For example:


FIND the record NO-LOCK to display it to the user and allow input into the user interface. FIND the record again EXCLUSIVE-LOCK when it is time to update the database record with the user's changes.
RELEASE the record when you are done with it.