LOKSER

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

This command specifies whether LOKSER is to be emulated.

Under A-Shell, shared file access may be controlled using either the older FLOCK.SBR / XLOCK.SBR or via LOKSER. In the case of LOKSER, a file opened for RANDOM processing is considered open for exclusive use, while for shared use it must be opened RANDOM’FORCED. Since many applications were written using FLOCK.SBR, which does not distinguish between RANDOM and RANDOM’FORCED, it is very inconvenient to have files effectively being exclusively opened when not required. For this reason, many sites do not use LOKSER.

If LOKSER is turned off under A-Shell, there is no difference in operation between RANDOM and RANDOM’FORCED files, and no automatic locking occurs in conjunction with OPEN, READ and WRITE statements. If LOKSER is turned on, then full file locking occurs with all the BASIC locking errors being trapped. Because of the nature of the LOKSER implementation on Windows and UNIX-based systems, the problem whereby locking a record exclusively would effectively lock all records in the same block, does not occur, as it does under pre-2.0 releases of AMOS.

Under AMOS, use of RANDOM’FORCED and INDEXED files force every write operation to actually be flushed to disk. This is necessary in order to get correct multi-user interaction due to the nature of the operating system. Under operating systems such as UNIX, or Windows, it is not necessary for the latest change to a file to actually be flushed to disk in order to be seen by other processes. The default operation of A-Shell is therefore not to flush on every write but to leave this a decision for the controlling operating environment.

On non-robust machines such as PCs, flushing to disk can be of particular importance, particularly if the PC is likely to be turned off or lose battery power at any time. The FORCE_WRITE modifier may be specified in this case which will cause such flushing to take place. and it may be specified both with and without the locking aspect of LOKSER.

Note that FORCE_WRITE only has effect under A-Shell/DOS. Due to its potential effect on performance, it is not recommended that it be used except where absolutely necessary. For example it would not be used on an optimized machine running Windows 95 which has write-behind caching enabled.

Under AMOS, the enabling of LOKSER also enables the seemingly unrelated feature of ISAM sequence checking for ISAM 1.x. This performs checks on the order of ISAM 1.x file accesses, preventing for example an ISAM add record being performed without an ISAM search to see if that record exists. Under A-Shell, ISAM sequence checking is also enabled if LOKSER is turned on:

LOKSER=ON{,FORCE_WRITE}

Notes

Under A-Shell, ISAM sequence checking is controlled by the value of the LOKSER command, on both UNIX and Windows systems.

There is no equivalent of the LOKSER database. Either all files are controlled or none. This is analogous to the operation of LOKSER under AMOS 2.0.

ISAM Plus files are implemented with C-ISAM or D-ISAM, and record locking for them is enabled permanently, regardless of the LOKSER setting.

A-Shell’s emulation of LOKSER requires the existence of the underlying operating system file locking mechanism, which may have to be configured or enabled. For example, under DOS, SHARE must be initialized.