Consultor Eletrônico



Kbase 19833: Who is Locking a Record in Progress?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   25/03/2011
Status: Verified

GOAL:

In multi-user environment it is sometimes useful to find programmatically who has a record locked.

GOAL:

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

GOAL:

Who is Locking a Record in Progress?

GOAL:

How to know who is locking the record?

FACT(s) (Environment):

All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x

FIX:

In multi-user environment it is sometimes useful to find who has a record locked.
By default, Progress displays the message:

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

This message provides information, but it is not usually what is wanted because users do not have a chance to commit changes or proceed without the STOP condition. Then they are returned to the startup procedure.

An application usually uses a code that informs users that a record is locked, but Progress does not have a function to display who locks the record. The code to show a locked record is:

FIND FIRST table WHERE field = ...
EXCLUSIVE-LOCK NO-WAIT NO-ERROR.
IF NOT AVAILABLE table AND LOCKED table
THEN MESSAGE "The record is locked".

To handle the error yourself, you can use the following piece of code:

REPEAT ON STOP UNDO,LEAVE:
FIND FIRST table WHERE field = ... EXCLUSIVE-LOCK NO-ERROR.
IF AVAIL customer THEN DO:
FIND CURRENT customer NO-LOCK.
MESSAGE "table is not locked".
END.
ELSE MESSAGE "table does not exist".
LEAVE.
END.


The code should be extended to prompt users for values to find the record. As it traps the STOP condition it can be put into an application menu as one item.

In Progress Versions 8.2 and later, programmers can use Virtual System Tables (VST).

Progress Solution 19136, "Record Locking How to Know Who Has the Record Using VST"