Open System Services System Calls Reference Manual (G06.28+, H06.05+)

System Functions (s and S) SPT_READLOCKX(2)
Use for key-sequenced, relative, and entry-sequenced files
For key-sequenced, relative, and entry-sequenced
les, a subset of the
le (dened by the current access path, positioning mode, and com-
parison length) is locked and read with successive calls to
SPT_READLOCKX().
For key-sequenced, relative, and entry-sequenced
les, the rst call to
SPT_READLOCKX() after a positioning (or open) locks and then
returns the rst record of the subset. Subsequent calls to
SPT_READLOCKX() without intermediate positioning locks returns
successive records in the subset. After each of the subsets records are
read, the position of the record just read becomes the les current posi-
tion. An attempt to read a record following the last record in a subset
returns an EOF indication.
Locking records in an unstructured file
You can use SPT_READLOCKX() to lock record positions,
represented by a relative byte address (RBA), in an unstructured le.
When sequentially reading an unstructured le with
SPT_READLOCKX(), each call to SPT_READLOCK[X() rst locks
the RBA stored in the current next-record pointer and then returns record
data beginning at that pointer for read_count bytes. After a successful
call to SPT_READLOCK[X(), the current-record pointer is set to the
previous next-record pointer, and the next-record pointer is set to the
previous next-record pointer plus read_count. This process repeats for
each subsequent call to SPT_READLOCKX().
Location of buffer and count_read
The buffer and count transferred can be in the user stack or in an
extended data segment. The buffer and count_read cannot be in the user
code space.
If the buffer and count_read is in a selectable extended data segment, the
segment must be in use at the time of the call. Flat segments allocated
by a process are always accessible to the process.
Transfer size The size of the transfer is subject to current restrictions for the type of
le.
Use on files opened for nowait I/O
If the buffer is in an extended data segment, you cannot deallo-
cate or reduce the size of the extended data segment before the
I/O completes with a call to the Guardian AWAITIOX procedure
or is canceled by a call to the SPT_CANCEL() function or the
Guardian CANCELREQ procedure.
You must not modify the buffer before the I/O completes with a
call to the Guardian AWAITIOX procedure. This restriction
also applies to other processes that might be sharing the seg-
ment. It is the applications responsibility to ensure this.
If you initiated the I/O with SPT_READLOCKX(), the I/O
must be completed with a call to the Guardian AWAITIOX pro-
cedure.
527186-007 Hewlett-Packard Company 7243