Created On: 31 May 2012
Problem:
There are several different operation codes available with the EXTFH file handler for doing random reads on an indexed file.
What is the difference between F6 READ (random) and 8E READ (random ) WITH NO LOCK?
| 8E | READ (random) WITH NO LOCK | R I |
| DA | READ (random) WITH LOCK | R I |
| DB | READ (random) WITH KEPT LOCK | R I |
| F6 | READ (random) | R I |
What is the difference between F6 READ (random) and 8E READ (random ) WITH NO LOCK?
Resolution:
The difference comes down to the lock mode that is set on for the file.
FhOp-Read-Random-No-Lock value x'8E' will always read a record without obtaining a lock for it, regardless of the lock mode used.
FhOp-Read-Random value x'F6' will either lock a record when read or not lock a record when read depending on the lock mode used in the open.
If lock mode automatic is set, then FhOp-Read-Random will lock the record.
If lock mode manual is set, then FhOp-Read-Random will not lock the record.
FhOp-Read-Random-No-Lock value x'8E' will always read a record without obtaining a lock for it, regardless of the lock mode used.
FhOp-Read-Random value x'F6' will either lock a record when read or not lock a record when read depending on the lock mode used in the open.
If lock mode automatic is set, then FhOp-Read-Random will lock the record.
If lock mode manual is set, then FhOp-Read-Random will not lock the record.
fcd-lock-mode pic x comp-x Lock mode flags for shareable files:
Bit 7 - Lock on multiple records
Bit 6 - WRITELOCK directive enabled
Bit 5 - RETRYOPEN=ON
Bit 4 - SKIPLOCK =ON
Bit 3 - RETRYLOCK=ON
Bit 2 - Lock mode MANUAL
Bit 1 - Lock mode AUTOMATIC
Bit 0 - Lock mode EXCLUSIVE
Old KB# 35988
#COBOL
#VisualCOBOL
#netexpress
#ServerExpress