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

246 AppendixB
BASIC/V Intrinsics
BKREAD
BKREAD
Transfers the next logical record from a KSAM file to a BASIC program.
CALL BKREAD(
filenum,status
[
,parameterlist
])
A call to BKREAD transfers the contents of a record from a KSAM file to a storage area
defined by a list of variables in a BASIC program. The record read is that at which the
logical record pointer is currently positioned. In a series of calls to BKREAD, records are read
in ascending order by key value. The primary key is used unless a previous call to BKSTART
or BKREADBYKEY has positioned the pointer to an alternate key. The file must have been
opened with an access mode that allows reading.
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 by 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 BKREAD was
successful and if not, why not. The first character is set to
zero when the call succeeds, to another value if not.
(
Required parameter
)
parameterlist
A list of variables separated by commas into which the
data in the record is read. The contents of the record are
read into the variable (or variables) until the physical
length (or combined physical lengths) of
parameterlist
is exhausted, or the end of the record is reached.
(
Optional parameter
) Default: If omitted, the logical
record pointer is positioned to the beginning of the next
record in key sequence.
Operation Notes
After calling BKREAD, you should always check the
status
parameter to determine
whether the read was successful. Upon successful completion of BKREAD, the variables
specified in
parameterlist
contain data read from the record at which the record pointer
was positioned when BKREAD was called. Note that if
parameterlist
is omitted, the record
pointer is positioned to the beginning of the next logical record, effectively skipping the
current record.
In order to use BKREAD, the file must be opened for input. The BKOPEN
access
parameter
should be zero if you plan to only read or position a record. To both read from and write to
the same open file, you either omit the
access
parameter or set it to 3. If you want to
rewrite or update as well as read records, you must set
access
to 4.