Consultor Eletrônico



Kbase P27130: How to find who is locking what table(s) using 4GL under 9.x?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/3/2008
Status: Verified

GOAL:

How to find who is locking what table(s) using 4GL under 9.x?

FACT(s) (Environment):

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

FIX:

The following code lists all the users currently locking database table records along with the table names involved:
DEFINE TEMP-TABLE ttLock NO-UNDO
FIELD iUSER AS INTEGER
FIELD cName AS CHARACTER
FIELD rRECID AS INTEGER
FIELD iTABLE AS INTEGER
FIELD cTABLE AS CHARACTER
INDEX UserName cName ASCENDING.
FOR EACH _Lock WHERE
_Lock._Lock-Usr <> ? AND
_Lock._Lock-Recid <> ? NO-LOCK:
/* Comment the next two statements to list the locked records individually */
FIND FIRST ttLock WHERE ttLock.iUSER = _Lock._Lock-Usr AND ttLock.iTABLE = _Lock._Lock-Table NO-LOCK NO-ERROR.
IF AVAILABLE ttLock THEN NEXT.
CREATE ttLock.
ASSIGN
ttLock.iUSER = _Lock._Lock-Usr
ttLock.cName = _Lock._Lock-Name
ttLock.rRECID = _Lock._Lock-Recid
ttLock.iTABLE = _Lock._Lock-Table.
END.
FOR EACH ttLock NO-LOCK:
FIND FIRST _File WHERE _File._File-Number = iTABLE NO-LOCK NO-ERROR.
ASSIGN
cTABLE = _File._File-Name.
DISPLAY
ttLock.iUSER LABEL "User Number"
ttLock.cName LABEL "User Name"
ttLock.cTABLE LABEL "Table Name".
END.