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

Appendix B 255
BASIC/V Intrinsics
BKSTART
BKSTART
Positions a KSAM file to a particular record based on a key value.
CALL BKSTART(
filenum,status
[
,keyvalue
[
,keylocation
[,
relation
]]])
By calling BKSTART, you can position the record pointer to any record in the file based on
the value of a key in that record. The key can be the primary key or any alternate key,
since BKSTART also allows you to select the key for positioning and for subsequent
sequential reads. If you want to read all the keys in a key sequence, you can use BKSTART
to position the pointer to the record with the lowest key value in the selected key.
Parameters
filenum
A numeric variable containing the file number that identifies the file. This
number was returned by the last call to BKOPEN. It should not be altered
unless the file is closed with a successful call to BKCLOSE. (
Required
parameter
)
status
A four-character string variable to which is returned a code that indicates
whether or not the call to BKSTART was successful and if not, why not. The
first character is set to zero when the call succeeds, to another value when
it fails. (
Required parameter
)
keyvalue
A string or numeric expression whose value is compared to a key value in
this record. The record pointer is positioned to the first record with a key
value that bears the relation specified by
relation
to the value in
keyvalue
. If the value is a string, its logical length is used for the
comparison; otherwise, the physical or dimensioned length is used. The
length of this value must be less than or equal to the length of the key as
specified when the file was created. If
keyvalue
is a null string (””), the
file is positioned to the beginning of the first logical record according to the
value of the key in
keylocation
. (
Optional Parameter
)
Default: If omitted, the value assumed for keyvalue is the lowest value for
the specified key type.
keylocation
A numeric expression whose value indicates the starting character
location in each record of the key used for positioning by BKSTART. The
characters in a record are counted starting with one. If set to zero, the
primary key is assumed. (
Optional parameter
)
Default: If omitted, the primary key is assumed.