Guardian Application Conversion Guide

Managing Your Disk Files
Converting Other Parts of an Application
096047 Tandem Computers Incorporated 8–11
FILE_GETLOCKINFO_ returns information about the lock in the
lock^description
buffer in this format:
word[0] Lock type (0 = file, 1 = record)
word[1] Flags: .<0> Lock is generic
.<1:15> Reserved
word[2] Number of participants
word[3:4] Record ID (if the lock is a record type and the file is not
key-sequenced)
word[5] Key length: Number of bytes in the keys for key-sequenced
record locks, or zero for non-key-sequenced record locks
word[6:n] Locked-key value (where n is determined by the length of the buffer)
The
participants
output parameter of FILE_GETLOCKINFO_ describes the
processes (or TRANSIDs) that hold or wait for the lock. The total size of
participants
depends on the
max^participants
parameter. Each 12-word
element in
participants
describes one process or TRANSID in this format:
word[0] Flags: .<0> Participant (0 = TRANSID, 1 = process handle)
.<1:3> Grant state (0 = waiting, 1 = granted)
.<4> Intent flag (0 = lock is not internally set by DP2,
1 = lock is internally set by DP2)
.<5:15> Reserved
word[1] Reserved
word[2:11] Process handle if word [0].<0> is 1; otherwise, a TRANSID
The ZSYSDDL file contains LITERAL declarations that you can use with the
lock^description
and
participants
parameters. To use these declarations,
include the appropriate file (ZSYSTAL, ZSYSCOB, ZSYSC, or ZSYSPAS) with your
source code file.
In the example below, FILE_GETLOCKINFO_ obtains information about a lock on a
disk file. The 10-word
control
parameter is used on a series of
FILE_GETLOCKINFO_ calls. On the first call, set
control
to zero; on successive
calls, return the unchanged value from the previous call.
! Return lock information for a disk file.
error := FILE_GETLOCKINFO_( file^name:file^name^length,
! process^handle ! ,
! trans^id ! ,
control,
lock^description,
lock^desc^length,
participants,
max^participants);