Files in z/OS UNIX file system support record I/O, but memory files do not.
As with all other record I/O, you can use only fread() and fwrite() to read from and write to files. Each call to fwrite() inserts a new-line in the byte stream; each call to fread() strips it off. For example, if you use one fwrite() statement to write the string ABC and the next to write DEF, the byte stream will look like this:
There are no limitations on lengthening and shortening records. If you then rewind the file and write new data into it, z/OS XL C/C++ will replace the old data. For example, if you used the rewind() function on the stream in the previous example and then called fwrite() to place the string 12345 into it, the stream would look like this:If you are using files with this model, do not use new-line characters in your output. If you do, they will create extra record boundaries. If you are unsure about the data being written or are writing numeric data, use binary instead of text to avoid writing a byte that has the hex value of a new-line.