UNLOCK

Contents


Unlock is used to unlock either a symbol or a table locked globally, or all the records previously locked in a table.

 

Syntax

   SYNTAX 1

   Unlock class_list

   SYNTAX 2

   Unlock symb_list

 

Parameters

Element

Description

Restrictions

class_list

List ofclass to be released, separated by the character ','.

None.

class

class: to release the whole of a locked table

class indicates the abbreviation for an open table.

symb_list

list ofsym to be released separated by a '.'.

None.

sym

to release a "symbol" indicated in the form:
symbol [From [server@]appli]
'='expr_c [From [server@]appli]

symbol

name_of_variable.

None.

expr_c

Alphanumeric expression whose result is a name_of_variable.

None.

server

name of a table server.

None.

appli

name_of_variable.

None.

 

Examples

   # Release of previously locked 'SYMBOL'
    Unlock SYMBOL

    # Read a record for modification of the ZONE field
     Trbegin TEST [TEST]
     Readlock [TEST]CLE2(1) = date$
     If [S]fstat
        [TEST]ZONE += 100
       
Rewrite [TEST]
        Unlock [TEST]
        Commit
       Else
        Rollback
     Endif

   # Consistency between the Lock and Unlock is required. There are two ways to write: either
   SYMBOLE = "FUNSTOACC"
   Lock    =SYMBOLE With lockwait     = 0
    ...
    Unlock =SYMBOLE

   # or
   Lock    FUNSTOACC With lockwait     = 0
    ...
    Unlock FUNSTOACC

Description and comments

The instruction Unlock is used to release either a globally locked file, or any symbol locked by Lock, or all the records of a file read by Readlock or by a For read loop with the With Lock option.

The instruction Unlock does not modify the fstat variable.

 

Comments

The system lock used when locking a tabke is automatically released when an Unlock is performed on this table.

A lock placed on a table is automatically removed when the table is closed (that is not accessible and no longer in memory, which happens particularly when quitting the application). This means that Close File performs an implicit Unlock. However, to retain a programme logic, it is advisable to perform an Unlock even if this instruction is to be followed by Close File.

Within a transaction (after Trbegin) records are automatically locked if they are modified, and unlocked at the end of the transaction. Unlock is thus not necessary to unlock records locked in this context. Tables locked before the transaction are all unlocked.
Conversely, the symbols will not be locked.

The Lock on a symbol is part of the current transaction; if there is a Rollback, it is cancelled, as are writes to an indexed file.

Locks may be applied to symbols belonging to an application other than the current one ("Lock symbol From application" is the syntax). In this case, Unlock a symbol to remove all the locks applied during this Adonix session in this application.

 

Associated errors

Error

Description

ERCLAS ( 7)

The file abbreviation given does not match a currently opened file.

ERMODE (10)

The arguments are not the type required.

 

Associated key words

LOCK - READLOCK - FOR - CLOSE - TRBEGIN - COMMIT - ROLLBACK - ADXTLK


CONTENTS


Copyright © Sage 1999 - 2007