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

FREADBYKEY

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 based on key value from a KSAM file to the target.

Syntax



  I16                 I16V     LA      I16V    CA     I16V
  lgth := FREADBYKEY (filenum, buffer, length, value, location);

Functional Return


lgth

16-bit signed integer by value (assigned functional return)

Returns the length of the information transferred.

  • If lgth is positive, it is a halfword count.

  • If lgth is negative, it is a byte count.

  • If lgth is 0, 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

logical array (required)

Returns the transferred record. It must be large enough to hold all the information to be read.

length

16-bit signed integer by value (required)

Passes the number of halfwords or bytes to be transferred. If length is positive, it is the length in halfwords. If negative, it is the length in bytes. If zero, no transfer occurs.

If length is less than the size of the record to be transferred, only the first length halfwords or bytes are transferred from the record. If the length is larger than the physical record size, only the physical record length is transferred.

value

character array (required)

Passes the key value determining the record to be read. The first record found with an identical key value specified by location is the record read.

location

16-bit signed integer by value (required)

Passes the relative byte location in the record of the key whose value determines which record is to be read. The first byte is numbered as 1. If 0 is specified, the primary key is used.

Operation Notes


This intrinsic does not read the advance flag. 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 FALSE.

Condition Codes


CCE

Request granted.

CCG

Request denied. The logical end-of-data or beginning-of-data was encountered during the read.

CCL

Request denied. An error occurred. Either an I/O error occurred or the key could not be located.

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




FREAD


FREADC