HPlogo Using KSAM XL and KSAM 64 > Chapter 9 KSAM Intrinsics

FREADDIR

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 4 ♥
E0394 Edition 3

Syntax Parameters Operation Notes Condition Codes

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.)

Condition Codes


CCE

Request granted. The information was read.

CCG

Request denied. End-of-data was encountered.

CCL

Request denied. The information was not read; an error occurred.

Refer to this intrinsic in the MPE/iX Intrinsics Reference Manual for other codes pertaining to KSAM files.




FREADC


FREADLABEL