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

136 Chapter9
KSAM Intrinsics
FREADBYKEY
FREADBYKEY
Reads a logical record based on key value from a KSAM file to the target.
Syntax
I16 I16V LA I16V CA
lgth
:=FREADBYKEY(
filenum,buffer,length,value,
I16V
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.