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

System Functions (s and S) SPT_WRITEX(2)
Inserting a new record into a file
The SPT_WRITEX() function inserts a new record into a le in
the position designated by the les primary key:
Key-sequenced files
The record is inserted in the position indicated
by the value in its primary-key eld.
Queue files The record is inserted into a le at a unique
location. The disk process sets the timestamp
eld in the key, which causes the record to be
positioned after the other existing records that
have the same high-order user key.
If the le is audited, the record is available for
read operations when the transaction associated
with the write operation commits. If the tran-
saction aborts, the record is never available to
read operations. If the le is not audited, the
record is available as soon as the write operation
nishes successfully. Unlike other key-
sequenced les, a write operation to a queue le
will never encounter a Guardian le-system
error 10 (duplicate record) because all
queue le records have unique keys generated
for them.
Relative files After an open or an explicit positioning by its
primary key, the record is inserted in the desig-
nated position.
Subsequent SPT_WRITEX() calls without
intermediate positioning insert records in suc-
cessive record positions. If -2 is specied in a
preceding positioning, the record is inserted in
an available record position in the le.
If -1 is specied in a preceding positioning, the
record is inserted following the last position
used in the le. An existing record does not
have to be in that position at the time of the
SPT_WRITEX() call.
Entry-sequenced files
The record is inserted following the last record
currently existing in the le.
Unstructured files
The record is inserted at the position indicated
by the current value of the next-record pointer.
If a record is to be inserted into a key-sequenced or relative le
and the record already exists, the SPT_WRITEX() call fails,
and a subsequent call to the Guardian FILE_GETINFO_ or
FILEINFO procedure shows that Guardian le-system error 10
occurred.
527186-007 Hewlett-Packard Company 7371