HP 3000 Manuals

DBLOCK [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

DBLOCK 

The DBLOCK statement applies a logical lock to a database, a data set, or
a data item value to all but one user.  Then, the user can write to the
locked area.  The PREDICATE statement aids in locking database items in
DBLOCK modes five and six.  Without the PREDICATE statement, the PACK
statement must be used to build a predicate string for the DBLOCK
statement.

Syntax 

DBLOCK dbname$ [, MODE [=] lock_mode]
[  {DATASET [=] dataset    }]
[, {DESCRIPTOR [=] str_expr}]

[, STATUS [=] status_array(*)]

Parameters 

dbname$          A string variable whose value is a TurboIMAGE database
                 name.  dbname must be the variable that was passed to a
                 successful DBOPEN.

lock_mode        Evaluates to an integer indicating the type of locking
                 desired:

                 Code             Effect
                 1 (default)      Locks database unconditionally
                 2                Locks database conditionally
                 3                Locks data set unconditionally
                 4                Locks data set conditionally
                 5                Locks data item entry unconditionally
                 6                Locks data item entry conditionally

                 If a data item is locked unconditionally in mode 5, the
                 entry for that item does not have to exist for the lock
                 to succeed.

dataset          A string expression with a maximum length of 16
                 characters.  Its value is the name of a data set.  The
                 name must be left-justified and if shorter than 16
                 characters must be terminated by a semicolon or blank.
                 This parameter can also be an integer or short integer
                 corresponding to the desired dataset number.  Required
                 only if lock_mode is three or four.

str_expr         A string expression that is required only if lock_mode 
                 is five or six.  Its value is a predicate lock string
                 that describes the locking condition.  The PREDICATE
                 statement is used to set up the predicate lock string.
                 The format of the PREDICATE lock descriptors is
                 presented in the description of the DBLOCK library
                 procedure in the TurboIMAGE/XL Database Management 
                 System.

status_array     A 10-element short integer array to which TurboIMAGE
                 returns an error code.  If an HP Business BASIC/XL
                 database statement specifies the STATUS option, an error
                 does not abort the program.  Following execution of the
                 database statement the program can check status_array 
                 and handle the error.  The values returned by TurboIMAGE
                 to this array are detailed in the description of the
                 status parameter of the equivalent TurboIMAGE library
                 procedure.

Examples 

The following examples show the use of the DBLOCK statement.  In line 30,
a PREDICATE statement has been issued for use with lines 150 and 160.

      30 PREDICATE Pred$ FROM Ds$ WITH Item$="skates"
     100 DBLOCK Db$,STATUS=S(*)
     110 DBLOCK Db$,MODE=1,STATUS=S(*)
     120 DBLOCK Db$,MODE=2,STATUS=S(*)
     130 DBLOCK Db$,MODE 3,DATASET Ds$,STATUS S(*)
     140 DBLOCK Db$,MODE 4,DATASET Ds$,STATUS S(*)
     150 DBLOCK Db$,MODE 5,DESCRIPTOR Pred$,STATUS S(*)
     160 DBLOCK Db$,MODE 6,DESCRIPTOR Pred$,STATUS S(*)



MPE/iX 5.0 Documentation