UNLOCK
Release a record lock on a channel
|
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
UNLOCK channel[, RFA:match_rfa]
Arguments
channel
The channel on which the file is open. (n)
RFA
(optional) Unlocks the record with the specified RFA. See RFA for a complete description.
Discussion
The UNLOCK statement releases an automatic lock on the specified channel or a lock specified by the RFA.
This statement is ignored if no lock conditions exist on the specified channel.
See also
- FREE routine
- Record locking
Examples
The following subroutine unlocks both automatic and manual locks.
subroutine rel_locks
a_chn ,n
a_rfa ,a
proc
if (^passed(a_rfa)) then
unlock a_chn, RFA:a_rfa
else
unlock a_chn
xreturn
endsubroutine
The following example reads and locks a relative record, and then prompts the user to add a new record, change the locked record, delete the locked record, or exit the routine. If the user selects exit or presses the EOF character, the record is explicitly unlocked.
subroutine proc_rec
a_chn ,d ;Channel of file open in update mode
a_data ,a ;Data record to read
a_recnum ,d ;Record number to read
.define TTCHN ,1
record
ans ,a1
proc
read(a_chn, a_data, a_recnum) ;Record locked
repeat
begin
display(TTCHN, "Add/Change/Delete/Exit: ")
reads(TTCHN, ans, exit)
case ans of
begincase
"A":
xcall add
"C":
xcall change
"D":
xcall delete
"E":
exitloop
endcase
end
exit,
unlock a_chn
xreturn
endsubroutine
