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 file in
the position designated by the file’s primary key:
Key-sequenced files
The record is inserted in the position indicated
by the value in its primary-key field.
Queue files The record is inserted into a file at a unique
location. The disk process sets the timestamp
field 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 file 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 file is not audited, the
record is available as soon as the write operation
finishes successfully. Unlike other key-
sequenced files, a write operation to a queue file
will never encounter a Guardian file-system
error 10 (duplicate record) because all
queue file 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 specified in a
preceding positioning, the record is inserted in
an available record position in the file.
If -1 is specified in a preceding positioning, the
record is inserted following the last position
used in the file. 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 file.
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 file
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 file-system error 10
occurred.
527186-007 Hewlett-Packard Company 7−371