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

Appendix B 231
BASIC/V Intrinsics
KSAM Logical Record Pointer
220 DOEND
300 IF S$(2)= "2" THEN PRINT "DUPLICATE KEY"
For any status value, you can call the BKERROR procedure and a message is returned that
gives the meaning of the status code. You can then print this message rather than writing
your own.
KSAM Logical Record Pointer
Many of the KSAM procedures use a
logical record pointer
to indicate the current
record in the file. This pointer points to a key value in the index area that identifies the
current record in the data area. The particular key used, if the file has more than one key,
is the key last specified in the current or a previous procedure call. By default, it is the
primary key.
Procedures that use pointers are either
pointer-dependent
or
pointer-independent
.
Pointer-dependent procedures expect the pointer to be positioned at a particular record in
order to execute properly. Pointer-independent procedures, on the other hand, execute
regardless of where the pointer is positioned and, in most cases, they position the pointer.
BASIC procedures do not access a KSAM file in physical sequence or by record number;
they ignore the physical pointer.
Table B-1. Positioning the Logical Record Pointer
Procedure
Name
Pointer-
Dependent
Position of Pointer After Execution of Procedure
BKSTART NO Points to key whose value was specified in call.
BKREADBYKEY NO Points to key whose value was specified in call.
BKWRITE NO Points to key whose value is next in ascending key sequence to
key value in record just written.
BKREAD YES Pointer remains positioned to key value for record just read;
unless the next call is to BKREAD, or to BKREWRITE followed by
BKREAD, in which case, the pointer is moved to the next record
in key sequence before the read.
BKDELETE YES Points to next key value in ascending sequence following key
value in record just deleted.
BKREWRITE YES Pointer remains positioned to key value for record just modified;
unless
any key value in record was changed, in which case, it
points to next key in ascending sequence after the key in the
modified record.