fwrite() is
the only interface allowed for writing to a file opened for blocked
I/O. Only one block is written at a time. If you attempt to write
more new data than a full block can hold or you try to update a block
with more data than it currently has, z/OS® XL C/C++ truncates
your output at the block boundary. When z/OS XL C/C++ performs
a truncation, it sets errno and raises SIGIOERR,
if SIGIOERR is not set to SIG_IGN.
When you write less than BLKSIZE bytes, if the request is to create
a new block, a short block will be created; if it is to update an
existing block, only requested part of the block will be updated.
z/OS XL C/C++ will not check the provided data. At the completion
of an
fwrite(),
the file position is at the start of the next block, and the block
is flushed out to the system. You might need to consider the following
cases:
- Because all fixed-format records must be full, any block you write
must be multiple of a record. Otherwise, z/OS XL C/C++ will fail the
write request.
- When updating an FBS short block at the end of file, it could
be updated to a full block or a longer short block from start of the
short block.
- When writing or appending to an FBS short block at the end of
file, z/OS XL C/C++ will use the request buffer to replace the previous
block, which might extend or shrink the short block.
- You must make sure that there is no short block in the middle
of an FBS data set.
- You must make sure that BDWs, RDWs, and SDWs in a block of variable
record file are correct.