Recording Locking - Who has the record ? As everyone who has worked in a multi-user environment knows, when you attempt to take a lock on a record which already has a lock, PROGRESS informs you of who has the pre-existing lock by means of a status message at the bottom of the screen. However, you have only two choice as to what to do next: either wait for the record to become available, or to press STOP, which returns you to your startup procedure. This restriction is often undesirable, since any data entered in a screen up to that point is lost. The way around the PROGRESS-imposed wait function is to test for a lock using the LOCKED function, and then give the user a choice of things to do. However, PROGRESS does not have a function which identifies the name, office location, email address and phone number of who is locking a particular record. If you had this information, it would be so much easier to let them know that they were keeping you from getting your work done! Because input through was changed to create a shell of its own in version 7, there are two different ways to find who has the record locked. VERSION 6 AND EARLIER The following procedure, which works only for UNIX, will return the userid locking a particular record. If you want their address and phone number, you'll have to program it yourself! The procedure needs three parameters passed to it. The first is the RECID of the record that is locked. The easiest way to get this is to read the record with no-lock and use the RECID function. The second parameter is the physical name of the database which contains the record. If you are using Version 5 of PROGRESS or are connected to only one database, pass the null string "". The third parameter (an input-output parameter) is the variable which will contain the userid of the person who is locking the record. (EDITOR'S NOTE: These routines have not yet been checked for functiona nor typos) /* chkuser.p Get the useridd of a user locking a record */ def input parameter m-recid as recid no-undo. def input parameter m-db as char no-undo. def output parameter m-userid as char no-undo. if m-db = "" then m-db = dbname. if opsys = "unix" then do: input through $DLC/promon value(m-db) value("<, 4 , recid , q , and q , The 'grep' statement allows only the line with the correct recid to be displayed. The 'awk' command extracts the second field from the line, which is the userid of the person locking the record. This is piped through and INPUT THROUGH statement, which SETs the m-userid parameter The INPUT is then closed. VERSION 7 AND LATER The following code samples have been tested on our systems but may need to be adjusted for your particular type of UNIX. The following code samples assume that the first customer record has been locked. Checker.p can be changed to reflect the record you are looking for and your database. /* checker.p */ DEFINE VARIABLE v1-user AS CHARACTER NO-UNDO. DEFINE VAR m-db AS CHARACTER FORMAT "x(15)". DEFINE VAR m-recid AS RECID. m-db = "sports". FIND FIRST customer NO-LOCK NO-ERROR. m-recid = RECID(customer). IF OPSYS = "unix" THEN DO: unix silent whosgot value(m-db) value(m-recid). END. INPUT FROM holder. SET v1-user. INPUT CLOSE. /* whosgot */ # dbname=$1 # recid=$2 echo "4" > who.has echo "4" >> who.has echo $2 >> who.has echo "Q" >> who.has echo "Q" >> who.has $DLC/bin/promon $1 < who.has 2>/dev/null | grep $2 | awk '{ {FS= " " } print $2~ }' >holder Progress Software Technical Support Note # 11200