Index Maintenance

This section contains some commands which are quite crucial to the proper operation of all commands related to indexes. There is the command to remove an index, but also some commands to assure index integrity.

When a record which is in an index is changed in a crucial place (any of the places which are relevant for the sorting or filtering of the record in the index), then the record can't be retrieved in the index any more. However the reference in the index will still exist. There are two methods to overcome this problem. You either have to update the index occasionally, or you have to preserve index integrity with the indexDELETE and indexIMPLEMENT commands. It is always interesting to rebuild your index from time to time. Records which are changed (or created) by other buffers can't preserve the integrity of your index.


Index DELete

If you want to remove a record from the file, or you may change a record, then it is best to delete it from the index.

This command will only work if the record you want to remove is still identical to the one that was put in the index as records in indexes can only be retrieved by their contents (and not by recordid).

So if you want to delete a record from the current buffer and the current index you should use a line like :

indexDELETE : DELrec
Sbasic
    indexDELETE #indexid
Assembler
    IDEL
    indexid
C
    long DDindexdelete(long indexid);

errors, code,   meaning
itnf    -7      invalid indexid (or bufferid)
imem    -3      insufficient memory

Index IMPlement

If you have a new record, or a record that you have (hopefully) deleted from the index before you changed it (or wanted to), then you can put it (back) in the index with this command.

This command will only work if the record has already been implemented in the file. So a new record is created and implemented in the current file and index like this :

NEWrec          : REMark take a new (empty) record
...             : REMark fill in the record
IMPLEMENT       : REMark implement in the file
indexIMPLEMENT  : REMark implement in the index
Sbasic
    indexIMPLEMENT #indexid
Assembler
    IIMP
    indexid
C
    long DDindeximplement(long indexid);

errors, code,   meaning
itnf    -7      invalid indexid (or bufferid)
imem    -3      insufficient memory

Index ReMoVe

This command is used to entirely remove an index from memory.

Sbasic
    indexREMOVE #indexid
Assembler
    IRMV
    indexid
C
    long DDindexremove(long indexid);

errors, code,   meaning
itnf    -7      invalid indexid (or bufferid)

PROGS, Professional & Graphical Software
last edited September 6, 1996