UNLOCK Statement

The UNLOCK statement releases execution locks set by the program.

Format

UNLOCK [expr]

Parameter(s)

expr

An expression evaluating to the lock number to be released. Valid lock numbers are from 0 to 255. If expr is omitted, all execution locks set by the program are released.

Description

The UNLOCK statement releases execution locks that were set by a LOCK statement in the program. It may be used either to release a specific lock or to release all locks currently set.

In writing a subroutine the user should unlock any execution locks explicitly with the lock number; otherwise, locks which might have been established by the main program could be lifted prematurely.

The UNLOCK statement does not affect file item locks established with the READU, READVU, or MATREADU statements. File item locks are released with a RELEASE, WRITE, WRITEV, MATWRITE, or DELETE statement.

If there are no current execution locks set, or the lock number specified has not been locked, no action is taken.

Example

In this application, the external subroutine REMOTE.MAIL uses the LOCK statement for execution lock number 122. The UNLOCK statement is used at the end of the subroutine. Note that lock number 122 is specified for the UNLOCK statement, so only the specific lock set by the current program is affected.

SUBROUTINE REMOTE.MAIL (MESSAGE, MODEMLINE)

LOCK 122 ELSE

   .

   .

   .

UNLOCK 122

RETURN

See Also

Statement and Function Reference