UNLOCK

Statement: Frees a record in a relative or sequential file that was locked by a previous READ statement.

Syntax

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.

See Also: Data Transfer I/O Statements, Branch Specifiers

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.