Using KSAM/XL and KSAM 64 (32650-90886)

140 Chapter9
KSAM Intrinsics
FREADDIR
FREADDIR
Reads a logical record located by its physical record number from a file to the buffer.
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 halfwords or bytes to be transferred. If this value is
positive, it signifies halfwords. A negative value indictates a transfer in
bytes. If zero, no transfer occurs.
If
length
is less than the size of the logical record, only the first
length
halfwords or bytes are read from the record. If
length
is larger than the
size of the logical record, the transfer is limited to the length of the logical
record.
lrecnum
32-bit signed integer by value (required)
Indicates the relative physical record number to which the physical
pointer is positioned. Physical record numbering for fixed-length records
starts with zero or one, as specified when the file was built.
Operation Notes
This intrinsic reads the advance flag. It sets only the physical pointer to the appropriate
record. When its function is completed, it sets the advance flag to TRUE.
This intrinsic is different from the FREAD intrinsic. The FREAD intrinsic reads only the
record already pointed to by the logical record pointer. FREADDIR inputs the specified
logical record. If the record is inactive, the contents of the inactive record are transmitted
and a CCE 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.)