Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

OPEN: BUFFERED Specifier

The BUFFERED specifier indicates runtime library behavior for READ and WRITE operations. Buffering of input records only applies to variable length, unformatted records. This specifier takes the following form:

BUFFERED = bf

bf

Is a scalar default character expression that evaluates to one of the following values:

'NO'

For WRITE operations: Requests that the runtime library send output data to the file system after each operation.

For READ operations on variable length, unformatted files: Requests that the runtime library transfer input data directly from disk to user variables for each operation.

'YES'

Requests that the runtime library accumulate data in its internal buffer, possibly across several READ or WRITE operations, before the data is transferred to, or from, the file system.

Buffering may improve runtime performance for output-intensive applications.

The default is 'NO' for buffering output. The default is also 'NO' when reading variable length, unformatted records whose length exceeds that of the block size specified for the file.

If BUFFERED='YES' is specified, the request may or may not be honored, depending on the device and other file or connection characteristics.

For direct access, you should specify BUFFERED='YES', although using direct-access I/O to a network file system may be much slower.

If both BLOCKSIZE and BUFFERCOUNT for OPEN have been specified with positive values, their product determines the size in bytes of the buffer for that I/O unit. Otherwise, the default size of the internal buffer is 8 KB (8192 bytes).

NOTE:

On Windows systems, the default size of the internal buffer is 1024 bytes if compiler option fpscomp general is used.

The internal buffer will grow to hold the largest single record but will never shrink.