|
Applies a logical lock to a database, one or more data sets, or one or
more data entries.
DBLOCK(base,qualifier,mode,status)
- base
-
is the name of an array used as the base parameter when opening the
database. The first element of the array must contain the base ID
returned by DBOPEN. (Refer to DBOPEN for more information about the
base ID.)
- qualifier
-
The qualifier argument depends on the mode:
- Modes 1,2,11,12: Ignored
- Modes 3,4,13,14: An integer variable referencing the data set
number or the name of an array containing a data set name. Could
also be "@" when applying a database lock.
- Modes 5,6,15,16: The name of the array containing the lock
descriptors.
- mode
-
contains an integer indicating the type of locking desired.
Valid modes are 1 to 6 and 11 to 16.
- status
-
is the name of an array of 10 halfwords in which the database returns
status information about the procedure. If the procedure executes
successfully, the status array contents are:
Element |
Contents |
1 |
If the procedure succeeds, the return status is 0.
Otherwise it provides a status code to describe the failure.
|
2 |
The number of lock descriptors that were successfully applied in
the DBLOCK request. For successful locks in modes 1 through 4
and 11 through 14 this will be 1.
|
3 |
Zero. TurboIMAGE used to return additional information
for a return status 20 which is not available with
Eloquence:
If the return status is 20, this element contains 0 if the
database is locked, 1 if the data set or entries are locked.
|
4 |
Unchanged from previous procedure call using this array.
|
5-10 |
Information about the current procedure call and its results.
|
DBLOCK modes:
Lock Mode |
Lock Level |
Locking Type |
Description |
1 |
Base |
Unconditional |
DBLOCK applies an unconditional lock to the
entire database, returning to the calling
program only after the lock is successful (or if
an error occurs). The qualifier parameter is
ignored.
|
2 |
Base |
Conditional |
DBLOCK applies a conditional lock to the
entire database and returns immediately. A return
status of zero indicates success. A non-zero
return status indicates the reason for failure.
|
3 |
Set |
Unconditional |
DBLOCK applies an unconditional lock to a data
set. The qualifier parameter must specify the
name of an array containing the left-justified
name of the data set or the name of an
integer referencing the data set number. The
data set name can be 16 characters long or, if
shorter, terminated by a semicolon or blank.
The data set need not be accessible for read
or write access to the user requesting the lock.
|
4 |
Set |
Conditional |
DBLOCK applies a conditional lock of the same
type as mode 3. It always returns to the calling
program immediately. A return status of zero
indicates success and a non-zero return
status indicates a reason for failure.
|
5 |
Entry |
Unconditional |
DBLOCK applies unconditional locks to the data
entries specified by lock descriptors. The
qualifier parameter must specify the name of
an array containing the lock descriptors. It
returns only when all the locks have been
acquired.
|
6 |
Entry |
Conditional |
DBLOCK applies conditional locks of the same
type as mode 5. If multiple lock descriptors are
specified and DBLOCK encounters a lock
descriptor that it cannot apply, it returns. All
locks that have been applied until that point
are released.
|
Modes 1 through 6 request a write lock.
Modes 11 through 16 are identical but request a read lock.
A write lock does block any concurrent read or write lock.
A read lock blocks concurrent write locks but allows
current read locks.
Notes:
|
|