The fputc() function, as defined by ANSI, puts a single character to the text stream. Special action occurs when writing a control character. On the other hand, the putc() macro buffers characters in storage and invokes fputc() only when encountering a control character. This reduces call overhead when you are writing one character at a time.
The default buffer size for memory files in hiperspace is 16K. You can override this by calling setvbuf() after fopen(), but before performing any I/O operations on the file. The minimum buffer size is 4K. If you specify a smaller size, it is ignored, and the default is used instead.
rc = setvbuf(fp, NULL, _IOFBF, 32768);
Alternatively,
if your memory is constrained, you can reduce requirements for memory
in the user address space by reducing the buffer size. This will
result in more frequent flushing of the buffer to the hiperspace.
For example,
rc = setvbuf(fp, NULL, _IOFBF, 4096);
For more information on hiperspace memory files, refer to Performing memory file and hiperspace I/O operations.
Many file attributes (DCB parameters) are possible when you open a file with z/OS® XL C/C++. DCB parameters specified on fopen() must be compatible with those of the file or the ddname. This checking may cause unwanted overhead.
You can use MVS memory files from z/OS UNIX C++ application programs. However, use of the fork() function from the program clears a memory file and removes access from a hiperspace memory file for the child process. Use of an exec function from the program clears a memory file when the process address space is cleared.
The non-hiperspace files use up your storage from below the line. Hiperspace memory files do not reside in user virtual storage. Changing a memory file to a hiperspace memory file saves user virtual storage only if the file is larger than one hiperspace memory file buffer.