Guardian Procedure Calls Reference Manual (G06.25+)
Guardian Procedure Calls (W-Z)
Guardian Procedure Calls Reference Manual—522629-013
16-10
WRITE[X] Procedures
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, the WRITE[X] procedure 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 WRITE[X] 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 the WRITE[X] 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 WRITE[X]
After a successful WRITE[X] 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);










