HPlogo Using KSAM XL: 900 Series HP 3000 Computer Systems > Chapter 9 KSAM XL Intrinsics

FFINDBYKEY

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Positions the record pointer at the beginning of the first record matching the key value comparison in a KSAM file.

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:

Value

Meaning

0

Equal

1

Greater than

2

Greater than or equal to

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

Operation Notes

Split stack calls are permitted.

The FFINDBYKEY intrinsic does not read the advance flag. It positions both the logical record pointer and the physical pointer to the appropriate record. When the function is complete, it sets the advance flag to FALSE.

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

Condition Codes

CCE

Request granted.

CCG

Request denied. The requested position was beyond the logical end-of-file or beginning-of-file.

CCL

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.

Refer to this intrinsic in the MPE/iX Intrinsics Reference Manual (32650-90028) for other codes pertaining to KSAM files.

Feedback to webmaster