D Eloquence Library
idb_lock(base,qual,mode,status) int base; void *qual; int mode; int status[10];The parameters are:
Mode | Target | Wait | Description |
---|---|---|---|
1 | database | Write Wait | Lock database for writing |
2 | database | Write | |
3 | data set | Write Wait | Lock data set for writing |
4 | data set | Write | |
5 | predicate | Write Wait | Lock using for writing |
6 | predicate | Write | using predicate spec |
11 | database | Read Wait | Lock database for reading |
12 | database | Read | |
13 | data set | Read Wait | Lock data set for reading |
14 | data set | Read | |
15 | predicate | Read Wait | Lock for reading |
16 | predicate | Read | using predicate spec |
A read lock allows concurrent read locks. A write lock does not allow any concurrent lock (it is a lock for WRITE).
A wait lock will block execution until lock is available. A lock without wait will return status error if lock is not available.
A lock with wait will fail and return status error if another lock has already been granted and the requested lock is not available.
The Lock Descriptor Format (next page) will explain how to set up predicate specification. Using predicate specification it is possible to lock database, data set(s) or (a group of) data item(s) to be locked.
Element | Meaning |
---|---|
0 | S_OK |
1 | 1 |
2 | 0 |
3 | 1 |
4 | 0 |
5 | DB_LOCK | (open_mode << 12) |
6 | 0 |
7 | 0 |
8 | mode |
9 | 0 |
if(idb_lock(dbid,"ORDER",4,status)) error_handler();This will lock ORDER data set.