Guardian Procedure Calls Reference Manual

Structured files
Inserting records into relative and entry-sequenced files
If the insertion is to a relative or entry-sequenced file, the file must be positioned currently
through its primary key. Otherwise, FILE_WRITE64_ fails with an error 46 (invalid key).
Current-state indicators after FILE_WRITE64_
After a successful FILE_WRITE64_, the current-state indicators for positioning mode and
comparison length remain unchanged.
For key-sequenced files, the current position and the current primary-key value remain
unchanged.
For relative and entry-sequenced files, the current position is that of the record just inserted
and the current primary-key value is set to the value of the record's primary key.
Duplicate record found on insertion request
When attempting to insert a record into a key-sequenced file, if a duplicate record is
found, FILE_WRITE64_ returns error 10 (record already exists) or error 71 (duplicate
record). If the operation is part of a TMF transaction, the record is locked for the duration
of the transaction.
Unstructured files
DP2 BUFFERSIZE rules
DP2 unstructured files are transparently blocked using one of the four valid DP2 blocksizes
(512, 1024, 2048, or 4096 bytes; 4096 is the default). This transparent blocksize,
known as BUFFERSIZE, is the transfer size used against an unstructured file. While
BUFFERSIZE does not change the maximum unstructured transfer (4096 bytes), multiple
I/Os may be performed to satisfy a user request depending on the BUFFERSIZE chosen.
For example, if BUFFERSIZE is 512 bytes, and a request is made to write 4096 bytes, at
least eight transfers, each 512 bytes long, will be made. More than eight transfers happen,
in this case, if the requested transfer does not start on a BUFFERSIZE boundary.
DP2 performance with unstructured files is best when requested transfers begin on
BUFFERSIZE boundaries and are integral multiples of BUFFERSIZE.
If the FILE_WRITE64_ call is to an unstructured disk file, data is transferred to the record
location specified by the next-record pointer. The next-record pointer is updated to point
to the record following the record written.
The number of bytes written
If an unstructured file is created with the odd unstructured attribute (also known as
ODDUNSTR) set, the number of bytes written is exactly the number specified in
write-count. If the odd unstructured attribute is not set when the file is created, the
value of write-count is rounded up to an even value before FILE_WRITE64_ is executed.
You set the odd unstructured attribute with the FILE_CREATE_, FILE_CREATELIST_, or
CREATE procedure, or with the File Utility Program (FUP) SET and CREATE commands.
File pointers after FILE_WRITE64_
After a successful FILE_WRITE64_ to an unstructured file, the file pointers have these
values:
current-record pointer: = next-record pointer
next-record pointer: = next-record pointer + count written
end-of-file (EOF) pointer: = max (EOF pointer, next-record pointer)
FILE_WRITE64_ Procedure 529