FREADDIR [ MPE/iX Intrinsics Reference Manual ] MPE/iX 5.0 Documentation
MPE/iX Intrinsics Reference Manual
FREADDIR
NM and CM callable.
Reads a specific logical record or portion of a record from a
direct-access disk file to the data stack.
Syntax
_______________________________________________
| |
| I16V UDS I16V I32V |
| FREADDIR(filenum,buffer,length,lrecnum);|
_______________________________________________
Parameters
filenum 16-bit signed integer by value (required)
Passes the file number of the file to be read.
buffer user-defined structure (required)
Returns the record that was read. This structure
should be large enough to hold all of the
information to be transferred.
length 16-bit signed integer by value (required)
Passes the number of half words or bytes to be
transferred. If this value is positive, it
signifies half words; if negative, bytes. Zero
signifies that no transfer occurs. If length is
less than the size of the logical record, only the
first length half words or bytes are read from the
record.
If length is larger than the size of the logical
record and the multirecord aoption in FOPEN/HPFOPEN
was not specified, the transfer is limited to the
length of the logical record. If the multirecord
aoption in FOPEN/HPFOPEN is specified, the
remaining half words or bytes specified in length
are read from the next records.
lrecnum 32-bit signed integer by value (required)
The relative number, in the file, of the logical
record or block number for the NOBUF files to be
read. A value of zero indicates the first logical
record.
(KSAM) Indicates the relative chronological record
number where the the chronological pointer is
positioned. Chronological record numbering for
fixed-length records starts with 0 or 1, as
specified when the file was built.
Operation Notes
This intrinsic is different than the FREAD intrinsic. The FREAD
intrinsic reads only the record already pointed to by the logical record
pointer. Issue the FREADDIR intrinsic only for disk files composed of
fixed-length or undefined-length records. If RIO access is used,
FREADDIR inputs the specified logical record. If the record is inactive,
the contents of the inactive record are transmitted and CCE (2) is
returned; there is no indication of the block containing some inactive
records. (FCHECK returns a nonzero error number to distinguish active
and inactive records.) If an RIO file is accessed using the non-RIO
method (NOBUF), FREADDIR inputs the specified block.
After the FREADDIR intrinsic is executed, the logical record pointer is
set to the beginning of the next logical record, or the first logical
record of the next block for NOBUF files.
It is possible to skip portions of records inadvertently, if the
multirecord aoption of FOPEN/HPFOPEN is set and the length parameter
specified is greater than one logical record. For example, if all of
record 11 and half of record 12 is read in a file, the logical record
pointer is set to the beginning of record 13 after the FREADDIR intrinsic
executes; the second half of record 12 is skipped.
Byte stream files are applicable with FREADDIR intrinsic. The lrecnum
parameter specifies a byte offset in the byte stream file, which is
equivalent to a logical record number, since the record size is one byte.
Not applicable to message files.
Condition Codes
CCE (2) Request granted. The information was read.
CCG (0) Request denied. End-of-file was encountered.
CCL (1) Request denied. The information was not read; an
error occurred.
Related Information
Intrinsics None
Commands None
Manuals Accessing Files Programmer's Guide (32650-90017),
Using KSAM XL (32650-90168), and KSAM/3000
Reference Manual (30000-90079)
MPE/iX 5.0 Documentation