Optional parameters

Some tableBASE commands allow for optional parameters to be passed to the tableBASE application programming interface (TBLBASE). It is very important that you do not pass NULL as the optional parameter to the call.

For example, GD (Get Definition) requires three parameters. The fourth parameter is the optional generation number. If the optional fourth parameter is supplied (even if NULL), tableBASE automatically looks in the library, directly bypassing the TSR, and incurs I/O. When the generation number is not supplied, TBLBASE checks the TSR for the opened table first before checking the library list. If found in the TSR, the results are returned, and any I/O is avoided. GD called with three parameters:

TBLBASE( tbParm, tbCommArea, tbDef );

As a second example, FK (Fetch by Key) requires three parameters. The fourth parameter is the optional Key Area. If the search key is in the Row Area and not in the Key Area, TBLBASE should be called with three parameters. Setting the fourth parameter to NULL might not cause the program to crash, but it is very likely you will never find the row, even if the row exists in the table.

There is another similar situation, in which the third parameter is not needed but the fourth parameter is. In this case, the solution is to use dummy parameters, variables of suitable type which are never used elsewhere in the program. They simply become placeholders in the parameters passed to TBLBASE.