MPE/iX Intrinsics Reference Manual (32650-90875)
252 Chapter6
Command Definitions (FLUSHLOG-GETUSERMODE)
FREAD
FREAD
NM and CM callable.
Reads a logical record or portion of a record from a file to the stack.
Syntax
I16 I16V UDS I16V
transfercount
:=FREAD(
filenum,buffer,length
);
Functional Return
transfercount
16-bit signed integer (assigned functional return)
Returns the length of the data transferred to
buffer
:
• If a negative value is passed in the
length
parameter,
transfercount
is a positive value indicating the number of bytes
transferred.
• If a positive value is passed in the
length
parameter,
transfercount
is a positive value indicating the number of half words transferred.
• If nowait I/O is specified in FOPEN/HPFOPEN, a zero is returned. The
record length is returned in the
length
parameter of the IOWAIT or
IODONTWAIT intrinsic.
NOTE
If the file was opened with the nowait I/O option enabled,
transfercount
is
zero. The IOWAIT intrinsic can be used to determine the length of the data
transferred.
Parameters
filenum
16-bit signed integer by value (required)
Passes the file number of the file to be read. If
filenum
references a
directory node, FREAD fails with a CCL file code.
buffer
user-defined structure (required)
Returns the record that was read. This structure must be large enough to
hold all of the information to be transferred.
length
16-bit signed integer by value (required)
Passes the length of the data to be transferred to
buffer
:
Value Meaning
<0 Length in bytes
=0
No transfer occurs