Multiple Record Transfers [ Accessing Files Programmer's Guide ] MPE/iX 5.0 Documentation
Accessing Files Programmer's Guide
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 also set the the inhibit buffering option
parameter to NOBUF in your HPFOPEN/FOPEN call or FILE command.
When you read from a file in multirecord mode, you may not read beyond
the EOF (end-of-file marker). When you write to a file in multirecord
mode, you may write only up to the block containing the file limit. If
your transfer exceeds its limit, a condition code of CCG is returned,
data is transferred only up to the limit, and the FREAD intrinsic returns
a transfer length of 0.
NOTE To obtain the actual transfer length for your data use the FCHECK
intrinsic, as described in the MPE/iX Intrinsics Reference Manual
(32650-90028). The transfer length is returned in the TLOG
parameter of FCHECK.
MPE/iX 5.0 Documentation