FLOCK()

From Recital Documentation Wiki
Jump to: navigation, search

Purpose

Function to lock file


Syntax

FLOCK([<workarea | alias>])


See Also

ACCESS(), LOCK(), LOCKF, LOCKR, RLOCK(), SET EXCLUSIVE, USE


Description

The FLOCK() function attempts to logically lock the currently selected table. If successful, it returns .T. and the table is locked. If the table is already locked by another user, it returns .F. If the optional <workarea | alias> name is specified the function will operate in the required location. The FLOCK() function does NOT change the open status of the table to 'exclusive'.

The Recital/4GL performs automatic record locking, which makes the use of the FLOCK() function unnecessary. The commands that require EXCLUSIVE use of the table are MODIFY STRUCTURE, REINDEX, PACK, INDEX ON <exp> TAG, and ZAP. For reasons of safety, the INDEX command should also be used only with exclusive use of the table.


Example

do while not flock()
    @23,0 say "Database in use. please wait."
    sleep 2
enddo


Products

Recital Server, Recital