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

Appendix B 229
BASIC/V Intrinsics
Status Parameter
Status Parameter
The status parameter is a four-character string variable to which the status of the
input/output operation is returned. It is the second parameter in every KSAM procedure
call except BKERROR, in which it is the first parameter.
The first character of the
status
string determines its general type. The other three
characters supply specific codes to further define the status. The operation of a called
procedure is successful only if the first character returned in
status
is zero. Other values
returned to
status
indicate the reason an operation was not successful. You can convert
any status value to a printable message by calling BKERROR. By combining the two parts of
the status code, the following values may be returned to the status parameter:
00
Successful completion
The current input/output operation was completed successfully; no
duplicate keys read or written.
02
Successful completion; Duplicate key
In a call to BKREAD or BKREADBYKEY, the current key has the same value
as the equivalent key in the next sequential record; duplicate keys are
allowed for the key.
In a call to BKWRITE or BKREWRITE, the record just written created a
duplicate key value for at least one key for which duplicates are
allowed.
10
At end condition
A sequential read was attempted with BKREAD and there was no next
logical record in ascending sequence according to the primary key value or
the current alternate key value. Or an attempt was made by BKSTART or
BKREADBYKEY to position the pointer to a record whose key value was less
than the lowest key value or higher than the highest key value.
21
Invalid key; Sequence error
In a call to BKWRITE for a file opened with sequence checking, the record
being written contains a primary key that is less than a key in a
previously written record.
In a call to BKREWRITE, the primary key value was changed in the
program since a successful execution of BKREAD defined the record to be
rewritten.
22
Invalid key; Duplicate key error
An attempt was made to write or rewrite a record with BKWRITE or
BKREWRITE and the record would create a duplicate key value in a key for
which duplicates are not allowed.