Accessing Files Programmer's Guide (32650-90885)

Chapter 7 113
Record Selection and Data Transfer
Multiple Record Transfers
RIO access
RIO is an access method that permits individual file records to be deactivated. These
inactive records retain their relative position within the file. RIO access is intended for use
primarily by COBOL programs; however, you can access these files by programs written in
any language. You create an RIO file using the
file type option
parameter of
HPFOPEN/FOPEN.
RIO files may be accessed in two ways, RIO access and non-RIO access. RIO access ignores
the inactive records when the file is read sequentially using the FREAD intrinsic, and these
records are transparent to you; however, they can be read by random access using
FREADDIR. They may be overwritten both sequentially and randomly using FWRITE,
FWRITEDIR, or FUPDATE. With non-RIO access, the internal structure of RIO blocks is
transparent.
Multiple Record Transfers
In almost all applications, programs conduct input/output in normal recording mode,
where each read or write request transfers one logical record to or from the data stack. In
certain cases, however, you may want your program to read or write, in a single operation,
data that exceeds the logical record length defined for the input or output file.
For instance, you may want to read four 128-byte logical records from a file to your data
stack in a single 512-byte data transfer. Such cases usually arise in specialized
applications. Suppose, for example, that your program must read input from a disk file
containing 256-byte records. This data, however, is organized as units of information that
may range up to 1024 bytes long; in other words, the data units are not confined to record
boundaries. Your program is to read these units and map them to an output file, also
containing 256-byte records.
You can bypass the normal record-by-record input/output, instead receiving data transfers
of 1024 bytes each, by specifying multirecord mode (MR) using the multirecord option
parameter in your HPFOPEN/FOPEN call or FILE command. For example:
:FILE BIGCHUNK; REC=-256,1,U;NOBUF;MR
\
Specifies multirecord mode
The essential effect of multirecord mode is to make it possible to transfer more than one
block in a single read or write. This mode effectively ignores block boundaries, and permits
transfers of as much data as you wish; it does not, however, break up blocks. Your transfers
must begin on block boundaries. In order to take advantage of multirecord mode, you must
File must be opened with Update access. No multirecord update allowed.
Successful update returns CCE condition code; file error results in CCL condition
code; end-of-file results in CCG condition code.
Table 7-1. Intrinsics for Data Transfer