# FILEUNLOCK

Updated: 10/19/2021, 9:29:48 PM
Created: 10/19/2021, 9:29:48 PM
Last Updated By: Kevin Munoz
Read Time: 1 minute(s)

# Description

This statement is used to release a file lock set by the FILELOCK statement. It takes the general form:

FILEUNLOCK [file.variable] [ON ERROR statements]
1

where

  • file.variable specifies a file previously locked with a FILELOCK statement. If file.variable is not specified, the default file with the FILELOCK statement is assumed. If file.variable is not a valid file variable then the FILEUNLOCK statement will enter the debugger.
  • The ON ERROR clause is optional in the FILEUNLOCK statement. The ON ERROR clause allows the programmer to specify an alternative for program termination when encountering a fatal error during processing of the FILEUNLOCK statement. If a fatal error occurs, with no ON ERROR clause specified, the program enters the debugger.

If the ON ERROR clause is used, the value returned by the STATUS  function is the error number.

In the following example, the first FILEUNLOCK statement unlocks the default file. The second FILEUNLOCK statement unlocks the file variable FILE.

OPEN '','file_one' ELSE STOP "Can't open file_one"
FILELOCK
FILEUNLOCK

OPEN 'file_two' TO FILEVAR ELSE STOP
FILELOCK FILEVAR
FILEUNLOCK FILEVAR
1
2
3
4
5
6
7

Go back to jBASE BASIC

Go back to Programmers' Reference Guide