Multiple buffering

Multiple buffering (or asynchronous I/O) is supported for z/OS® data sets. Multiple buffering is not supported for a data set opened for read at the same time that another file pointer has it opened for write or append. When you open files for multiple buffering, blocks are read into buffers before they are needed, eliminating the delay caused by waiting for I/O to complete. Multiple buffering may make I/O less efficient if you are seeking within or writing to a file, because seeking or writing may discard blocks that were read into buffers but never used.

To specify multiple buffering, code either the NCP=xx or BUFNO=yy subparameter of the DCB parameter on the JCL DD statement (or allocation), where xx is an integer number between 02 and 99, and yy is an integer number normally between 02 and 255. Whether z/OS XL C/C++ uses NCP or BUFNO depends on whether you are using BSAM or QSAM, respectively. NCP is supported under BSAM; BUFNO is supported under QSAM. BSAM and QSAM are documented in z/OS DFSMS Using Data Sets. If you specify noseek, z/OS XL C/C++ uses QSAM if possible. If z/OS XL C/C++ is using BSAM and you specify a value for BUFNO, z/OS XL C/C++ maps this value to NCP. If z/OS XL C/C++ is using QSAM and you specify a value for NCP, z/OS XL C/C++ maps this value to BUFNO.

If you specify both NCP and BUFNO, z/OS XL C/C++ takes the greater of the two values, up to the maximum for the applicable value. For example, if you specify a BUFNO of 120 and you are using BSAM, which uses NCP instead, z/OS XL C/C++ will use NCP=99.

If you do not specify either, z/OS XL C/C++ defaults to single buffering, except in the following cases, where z/OS XL C/C++ uses the system's default BUFNO and performs multiple buffering for both reading and writing:
  • If you open a device that does not support repositioning, and specify read-only or write-only mode (r, rb, w, wb, a, ab).
  • If you specify the NOSEEK parameter on the call to fopen() or freopen(), and specify read-only or write-only mode. When you specify NOSEEK, you get multiple buffering for both reads and writes.
Here is an example of how to specify BUFNO:
   //DD5   DD    DSNAME=TORONTO.BLUEJAYS,DISP=SHR,DCB=(BUFNO=5)

You may need to update code from previous releases that relies on z/OS XL C/C++ ignoring NCP or BUFNO parameters.

Note: Multiple buffering is ignored for concatenated and multivolume data sets.