Recapping the examples
All the major functions of B-TREE-P have now been demonstrated. You began with a typical Pick data file (the NAMES file) and a typical data entry program (the GET.NAMES program), that in no way used B-trees. You then created a new, empty data file (the B-TREE file) for holding three different B-trees that allow your name and address data to be browsed three different ways. You executed a small utility program (the BUILD program) to scan every item in your existing name and address file and to create the initial version of the three B-trees stored in the B-TREE file. You then used a browser program (the BROWSE.NAMES program) to use the B-trees and allow the display of your names and addresses in a variety of formats. Then you made some minor adjustments to the original GET.NAMES program so that it would continue to adjust the B-TREE file any time a name and address item was created, changed, or deleted in the NAMES file, insuring that the browser display would always be up to date. Finally, you used another small utility program (the LIST.NAMES program) to list all of the NAMES items in any B-tree order, without having to wait for a sort.
Note that because the B-TREE-P subroutines only operated on the B-TREE file, the contents and structure of the NAMES file never had to be changed or modified.
Five different B-TREE-P subroutines have been demonstrated: BTPINS inserts new items into B-trees, BTPDEL deletes existing items from B-trees, BTPFIND locates items in B-trees, BTPSEQ locates next and previous items in B-trees, and BTPKEY specifies the sort order of B-trees. The first four subroutines never have to modified, regardless of the types of data files for which B-trees are being created. Only BTPKEY needs to be adjusted for each B-tree you create, in order to control how the B-tree will be sorted.