13.8 UNLOCK Statement

The UNLOCK statement frees a record in a relative or sequential file that was locked by a previous READ statement.

The UNLOCK statement takes one of the following forms:

UNLOCK ([UNIT=]io-unit [, ERR=label] [, IOSTAT=i-var])
UNLOCK io-unit


io-unit
Is an external unit specifier.


label
Is the label of the branch target statement that receives control if an error occurs.


i-var
Is a scalar integer variable that is defined as a positive integer if an error occurs and zero if no error occurs.

If no record is locked, the UNLOCK statement has no effect.

Examples

The following statement frees any record previously read and locked in the file connected to I/O unit 4:

  UNLOCK 4
Consider the following statement:
  UNLOCK (UNIT=9, IOSTAT=IOS, ERR=10)

This statement frees any record previously read and locked in the file connected to unit 9. If an error occurs, control is transferred to the statement labeled 10, and a positive integer is stored in variable IOS.

For More Information:


Previous Page Next Page Table of Contents