TACL Reference Manual

Built-In Functions and Variables
HP NonStop TACL Reference Manual429513-018
9-251
#LOCKINFO Built-In Function
#SET keylen [buffer:lib:keylen]
#SET fname [vol].[buffer:lib:svol^file(0:7)]
#SET fname [fname].[buffer:lib:svol^file(8:15)]
#SET numlab [buffer:lib:numlab]
#SET laboff [buffer:lib:laboff]
== Display them.
#OUTPUT type: [buffer:lib:type]
#OUTPUT keylen: [keylen]
#OUTPUT laboff: [laboff]
== Is it a record lock or a file lock?
[#IF ([buffer:lib:type]) |THEN|
#OUTPUT RECORD LOCK on [fname]
[#IF (keylen = 0) |THEN|
#OUTPUT ID: [buffer:lib:recaddr]
|ELSE|
#OUTPUT ID: [buffer:lib:keyval(0:[#compute (keylen-1)])]
]
|ELSE|
#OUTPUT FILE LOCK on [fname]
]
== Show number of lockers/waiters.
#OUTPUT [numlab] locks and waits for [fname]
] == end DISPLAY_LIB macro
== Define macro to display all labinfo entries returned for &
one locked resource (a file or a record).
[#DEF display_lab MACRO |BODY|
== Loop for each labinfo entry. There are [numlab] entries.
#SET count 0
[#LOOP |WHILE| (count < numlab) |DO|
== Compute location of current labinfo entry.
#SET start [#COMPUTE laboff + (labinfolen * count)]
#SET stop [#COMPUTE start + labinfolen-1]
== Copy entry from buffer to labinfo structure.
#SETBYTES labinfo buffer:generic:onechar([start]:[stop])
== Display entry.
#OUTPUTV labinfo
== Increment entry number.
#SET count [#COMPUTE count + 1]
] == end #LOOP
] == end DISPLAY_LAB macro
== Initialize variables
#PUSH vol err tag
#PUSH type keylen fname numlab laboff