Guardian Application Conversion Guide
Obtaining Lock Information
Converting TACL Programs
096047 Tandem Computers Incorporated 7–9
Obtaining Lock
Information
Your existing program might use the #LOCKINFO built-in function to obtain
information about record locks and file locks. For example:
#LOCKINFO lock^spec tag buffer
Convert your program to use the #FILEGETLOCKINFO built-in function to get
information about a lock (either held or pending). Each time you use
#FILEGETLOCKINFO, it returns information about one lock. If you need information
about several locks, invoke #FILEGETLOCKINFO several times.
In addition to providing the name of the file, you must also provide the following
STRUCTs:
control A 10-word variable that controls a series of calls to
#FILEGETLOCKINFO. Set control word [0] to 0 the first time you
call #FILEGETLOCKINFO. On successive calls, simply use the value
of control returned by the previous call.
lockdesc Receives the lock information.
participants Receives process handles or transaction IDs for processes or
transactions that wait for the lock.
In the example below, #FILEGETLOCKINFO returns information about a lock on a
disk file.
[#DEF control STRUCT
BEGIN
INT x(0:9);
END;
]
[#DEF lockdesc STRUCT
BEGIN
INT lock^type; == 0 = file, 1 = record
UINT flags; == <0> set if generic lock
INT n^participants; == number of holders/waiters
== for lock
INT key^length; == for key-sequenced record
== locks; 0 if not
== key-sequenced
CHAR key(0:255); == key for key-sequenced
== record locks
END;
]