Kbase P13706: Record Locking - How to Know Who Has the Record Using VST
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  30/04/2004 |
|
Status: Unverified
GOAL:
Record Locking - How to Know Who Has the Record Using VST
FIX:
In order to visualize how VST works, a sample program that locks a
record using the FIND statement is needed. The following example code
that uses the customer table is used to illustrate:
FIND customer WHERE cust-num = 15 EXCLUSIVE-LOCK.
UPDATE cust-num name.
Run this example in a Progress session. It stops in the update and
locks the record as long as the -lkwtmo parameter allows (this is a
broker startup parameter that is available in Versions 8.1 and later).
The PROMON utility can now be used to identify what user has a
particular record locked. The information is available at screen 4 -
Record Locking table. This option the provides a filter by user
number, range of user numbers, by record, and it lists all entries in
the record table.
These two options do not let us programmatically know the user name of
the user who is locking a particular record. The use of VST to
discover who has a particular record locked is done by querying the
tables _connect and _lock:
- _connect = Connection information
- _lock = Record Locking Table information
In Progress Versions 8.2 and 8.3:
VST must be unabled using the command, proutil -C enablevst. The
following sample program uses the record key to get the RECID of
the record and uses it to query the _lock table. Then it queries
the _connect table to get the information about the device the
user is connected to:
DEF VAR wrecid AS INT.
FIND customer WHERE cust-num = 15 NO-LOCK.
wrecid = RECID(customer).
FIND FIRST _lock WHERE _lock-recid = wrecid
AND _lock-flag = "X" NO-LOCK.
DISPLAY _lock-usr _lock-name _lock-flag
WITH FRAME A.
FIND FIRST _connect WHERE _connect-usr = _lock-usr NO-LOCK.
DISPLAY _connect-usr _connect-name _connect-device
WITH FRAME b.
In Progress Version 9.x:
VST is enabled by default. There is an update to the VST
procedure but it is not required to access the tables mentioned here.
The Version 9 program is very similar to that for Versions 8.2 and
8.3, but since the RECIDs in Version 9 are not unique in the database
but within a table, the program must filter by the table. The
following example code uses the _file table:
DEF VAR wrecid AS INT.
DEF VAR wtable AS INT.
FIND customer WHERE cust-num = 15 NO-LOCK.
wrecid = RECID(customer).
FIND _file WHERE _file-name = "customer" NO-LOCK.
wtable = _file._file-num.
FIND FIRST _lock WHERE _lock-recid = wrecid
AND _lock-table = wtable
AND _lock-flag = "X" NO-LOCK.
DISPLAY _lock-usr _lock-name _lock-flag
WITH FRAME A.
FIND FIRST _connect WHERE _connect-usr = _lock-usr NO-LOCK.
DISPLAY _connect-usr _connect-name _connect-device
WITH FRAME b.
Progress Versions previous to 8.2:
A program that accesses PROMON can be used to determine who has a
particular record locked in versions earlier than 8.2. (Refer to
Progress KBase 11200.)
Reference to Written Documentation:
Progress System Administration Reference.
Progress Knowledge Base Solution 11200, "Record Locking - Who has the
record?".