B-TREE-P error messages

The message Already inserted! will be displayed by the BTPINS subroutine when it detects an attempt to insert an item identifier that is already in a B-tree. This error is non-fatal, and BTPINS simply returns without attempting the insertion.

Similarly, BTPDEL will display Already deleted! when it detects an attempt to delete an item identifier that is not in a B-tree. This error is also non-fatal, and BTPDEL returns without attempting the deletion.

All other errors detected by the B-TREE-P subroutines cause the execution of a STOP statement, which causes the display of the message ERRMSG [BTPx], where x is a number from 1 to 24.

ERRMSG [BTP7] is caused by using a B-tree name that does not have a corresponding CASE statement in the BTPKEY subroutine.

ERRMSG [BTP8] is caused by calling BTPFIND with an invalid B-tree name in that routine's first argument.

ERRMSG [BTP11] is caused by calling BTPSEQ with a node number in that routine's second argument that was not set by a previous call to BTPFIND.

ERRMSG [BTP15] is caused by calling BTPDEL with an invalid B-tree name in that routine's first argument.

All other BTP numbers in ERRMSG displays are caused by B-trees with inconsistent or damaged data that prevent the B-TREE-P subroutines from operating properly. The only solution is to delete the offending B-tree and rebuild it from scratch with a utility program like the BUILD example, after identifying and correcting the cause of the damage to prevent it from happening again.

Like all files in a multiuser environment, B-tree data can deteriorate if access is not properly programmed and syncronized. Damaged B-trees are easily prevented by following these rules: