HPlogo MPE/iX Intrinsics Reference Manual > Chapter 5 Command Definitions (FCONTROL - FLOCK)

FFINDBYKEY

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701 ♥
Edition 7 E0300
Edition 6 E0195

NM and CM callable.

Positions the record pointer at the beginning of the first record matching the key value comparison.


NOTE: For KSAM files only.

Syntax



              I16V     CA     I16V      I16V    I16V
  FFINDBYKEY (filenum, value, location, length, relop);

Parameters


filenum

16-bit integer by value (required)

Identifies the file number of the file to be positioned.

value

character array (required)

Contains a value that determines which record is read. This value is compared to the data contained in location in relation to the operator specified in relop.

location

16-bit integer by value (required)

Specifies the relative byte location in the record of the key being used. Bytes are numbered starting with 1. If location=0, the primary key is used.

length

16-bit integer by value (required)

Specifies the length of the key in bytes. If length=0, then the entire key is used. If length is less than the full key length (generic key), then only the length specified is used in the comparison with relop. The length parameter must be equal to or less than the full length of the key when the file was created. For numeric display keys or packed decimal keys, the full key length must be used.

relop

16-bit signed integer by value (required)

Specifies the relational operator for the comparison of the key value of the file to the value specified in value. The record where the file is positioned has this relation to key value:

ValueMeaning
0Equal
1Greater than
2Equal to or greater than

When relop is set to 1 or 2, the search is for an approximate key.

Operation Notes


Split stack calls are permitted.

Can be used prior to a call to FREADC to position the chronological pointer to the record located by the specified key.

To locate and read a single record, use the FREADBYKEY intrinsic.

Condition Codes


CCE (2)Request granted.
CCG (0)Request denied. The requested position was beyond the logical end-of-file or beginning-of-file.
CCL (1)Request denied. An error occurred: an I/O error occurred, the relop parameter could not be satisfied, a length less than the full length was specified for a key with numeric display or packed decimal format, or a key was not found when relop=0.

Related Information


Intrinsics FINDN, FREADBYKEY, FREADC, FREMOVE
Manuals Using KSAM XL
KSAM/3000 Reference Manual




FFILEINFO


FFINDN