Please enable JavaScript to view this site.

A-Shell Reference

Rewritten June 2023

LOKSER=['ON' | 'OFF'] {,FORCE_WRITE}

This directive specifies whether LOKSER is to be activated. LOKSER is a file locking scheme involving a combination of OS-level locking operations and rules governing file access. When not enabled, all file operations are lock-free from the standpoint of the operating system, requiring applications to employ some other kind of A-Shell locking mechanism such as XLOCK or FLOCK in order to coordinate multi-user access.

When LOKSER is enabled:

Random files opened in mode RANDOM are effectively opened exclusively.

Random files opened in mode RANDOM'FORCED are shared

In shared mode, the READ statement reads without locking while READL reads and locks the record. WRITE unlocks the record after writing (requiring a prior READL), while WRITEL locks, writes, and then unlocks. UNLOKR can be used to unlock a record without writing.

Attempts to read a locked record, or to open a file in a mode that conflicts with another user already having the file open, unless the WAIT_FILE or WAIT_RECORD option is specified on the open, will generate one of the LOKSER-related errors 37 (file in use) or  38 (record in use).

Other LOKSER-related errors include 42 (record not locked) and 44 (LOKSER queue full due to too many locks being held at once).

ISAM sequence checking—a set of rules dictating the sequence of ISAM File Statements—is activated, generating ISAM error 39 on any violation.

ISAM-A operations always act as if LOKSER is enabled, i.e. they use OS-level file locking regardless of the LOKSER setting. However, they do respect the FORCE_WRITE option if enabled.

The FORCE_WRITE option requests that file updates be flushed to disk immediately.  It is generally supported for Random file WRITE operations under Windows, and for ISAM-A operations in all environments.  But it drastically slows down performance and thus is not recommended.