Using KSAM/XL and KSAM 64 (32650-90886)

Chapter 9 97
KSAM Intrinsics
FFINDBYKEY
FFINDBYKEY
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.