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

FREAD

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 4 ♥
E0394 Edition 3

Syntax Functional Return Parameters Operation Notes Condition Codes

Reads a logical record in key sequence from a file to the buffer.

Syntax



  I16            I16V     UDS     I16V
  lgth := FREAD (filenum, buffer, length);

Functional Return


lgth

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,the lgth is a positive value indicating the number of bytes transferred.

  • If a positive value is passed in the length parameter, the lgth is a positive value indicating the number of halfwords transferred.

  • If a value of 0 is passed in the length parameter, the position is identified, but the data is not returned.

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 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. If this value is positive, it signifies the length in halfwords. If negative, it signifies the length in bytes. If zero, no transfer occurs.

If length is larger than the size of the logical record, transfer is limited to the length of the logical record. If less than the size of the logical record, the transfer is limited to the length specified.

Operation Notes


This intrinsic reads the advance flag and advances to the next record if the flag is set to TRUE. It positions the logical record pointer and the physical pointer to the appropriate record. When its function is complete, it sets the advance flag to TRUE.

When the logical end-of-data is encountered, CCG is returned to the process.

Condition Codes


CCE

Request granted. The information was read.

CCG

Request denied. The logical end-of-data was encountered during reading.

CCL

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

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




FPOINT


FREADBYKEY