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

228 AppendixB
BASIC/V Intrinsics
Calling a KSAM Procedure
Calling a KSAM Procedure
The KSAM interface procedures are called from a BASIC program with a CALL statement
of the following general form:
statementlabel
CALL
procname
(
filenumber, status
[,
parameterlist
])
Where:
statementlabel
The number of the statement in the program.
procname
The KSAM access procedure to which control is
transferred.
filenumber
A numeric variable whose value identifies an open KSAM
file. This parameter must be present. Its value is assigned
when the file is opened and must not be changed until the
file is closed.
status
A 4-character string variable to which a code is returned
that indicates whether the current operation was
successful or not, and if not, the reason for failure.
parameterlist
A set of one or more parameters that, if present, further
define input/output operations on this file.
The first two parameters,
filenumber
and
status
are included in every KSAM procedure
call, except BKERROR and BKVERSION. The parameters in
parameterlist
depend on the
procedure in which they are used. Some
parameterlist
parameters are optional and, if
omitted, default values are assigned by KSAM. Such parameters are indicated by brackets
in the procedure call format. The required parameters
filenumber
and
status
are both
variables, the first numeric, the second string. Other parameters are either variables or
expressions. Expressions are either variables or constants, or a combination of both. The
data type of the parameter depends on its definition in the procedure. The procedure call
formats specify the data type of each parameter.
Depending on the procedure, certain variables can be assigned values as a result of
executing the procedure. The procedure itself is never assigned a value.
Optional Parameters
When parameters in
parameterlist
are optional, those parameters are surrounded by
brackets. In a series of optional parameters, the enclosing brackets are nested. For
example:
CALL name (
filenum,status
[,
param1
[,
param2
[,
param3
]]])
This notation tells you that parameters can be omitted only from the end of the optional
list; parameters cannot be omitted from the middle or beginning of the list. For example, if
you want to specify
param3
, you must also specify the preceding parameters,
param1
and
param2
. If you specify
param2
, you can omit the following parameter
param3
, but not the
preceding
param1
.