Sharing Files and Locking Records
8.4 Ensuring Successful Record Locking
When you close a file, any existing record lock is released automatically. The
UNLOCK RECORD statement releases the lock only on the current record on
OpenVMS Alpha systems, which is the last record you successfully accessed. On
Tru64 UNIX systems for indexed files only, there is no current record lock.
8.4.3 Error Handling for Record Locking
This section describes the locking error conditions and the two kinds of locks:
hard and soft.
Note
Soft record locks are available for Compaq standard record locking but
are not part of X/Open standard. Soft record lock conditions also do not
occur on the Tru64 UNIX system for indexed files.
Any record contention error results in an unsuccessful statement for which a USE
procedure will be invoked. A ‘‘record-locked’’ condition results in an I-O status
code of 92.
Interpreting Locking Error Conditions
Two record-locking conditions (hard and soft record lock) indicate whether a
record was transferred to the record buffer. Compaq COBOL provides the success,
failure, or informational status of an I/O operation in the file status variable.
Hard Record Locks
A hard record lock condition, which causes the file status variable to be set to 92,
indicates that the record operation failed and the record was not transferred to
the buffer. A hard record lock results from a scenario such as the one shown in
the following steps, which uses Compaq standard manual record-locking mode:
1.
Program A opens the file I-O ALLOWING ALL.
2.
Program A reads a record ALLOWING NO OTHERS.
3.
Program B opens the file I-O ALLOWING ALL.
4.
Program B tries to access the same record as A.
5.
Program B receives a hard record lock condition.
6.
The record is not accessible to Program B.
7.
Program B’s File Status variable is set to 92.
8.
Program B’s USE procedure is invoked.
9.
Program A continues.
The record was not available to Program B.
On Tru64 UNIX, for INDEXED files, READ with the ALLOWING UPDATERS
clause as well as any START statement will not detect a locked record. Potential
conflicts do not trigger a hard lock condition, only actual conflicts do.
♦
Sharing Files and Locking Records 8–23
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......