Writing to blocked I/O files

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: