Asynchronous Serial Communications Programmer's Reference Manual (32022-90052)

Chapter 9 249
Intrinsics Reference (cont)
FREAD
FREAD
Transfers a record of data from an input device to the user’s data area.
Syntax
I16 16V UDS I16V
transfercount
:=FREAD(filenum,buffer,length);
Use
Use the FREAD intrinsic to read a logical record from a file to the user’s
data area. For asynchronous devices, this implies the transfer of data
(one record at a time) from an input device, usually a terminal, to the
data area. Condition codes are used to indicate completion status and
should be checked after each read, whether you are using NOWAIT I/O
or normal I/O processing. Read timeouts or timers must be set prior to
an FREAD by calls to the appropriate FCONTROL functions.
When the logical end-of-data is encountered during a read, CCG is
returned to your process. The end-of-data is indicated by a hardware
end-of-file; on $STDIN, by any record beginning with a colon (:); or on
$STDINX by :EOD.
Functional Return
transfercount 16-bit signed integer (assigned functional
return)
Assumes a value corresponding to the length of the
information transferred. If the value specified in the
length parameter of the call was a positive number, the
value returned in
transfercount
is positive, and
represents a halfword count. If the value specified in
the length parameter was negative, the value returned
in
transfercount
represents a byte count.
FREAD always returns a zero if you specified NOWAIT
I/O in FOPEN or HPFOPEN. In this case, the actual
record length is returned in the length parameter of
the IOWAIT or IODONTWAIT intrinsic.
Parameters
filenum 16-bit signed integer by value (required)
The file number of the file to be read.
buffer user-defined structure (required)