Removing Indexing Manually


Sometimes you need to remove indexing from a file manually. This is usually happens when you clear or delete the indexing file (!filename) explicitly, which also deletes important control information. When you then try to remove indexing from the file, the system returns an error message.


In order to remove indexing from a file manually, there are three steps to be performed.

_ Update the volume directory (formerly known as the media map).

_ Delete the indexing file.

_ Update the individual dictionary records. Each of these steps will be covered in turn. Updating the Volume Directory The volume directory maintains information about each file in a volume. Part of that information is a list of Modifying Filing Systems (MFSs) associated with the file. When a file has indexing on it, an MFS called SI.MFS is placed on the file. This MFS must be removed. To remove the MFS, follow these steps.

_ Log to the account SYSPROG. Volume directories can only be edited from SYSPROG.

_ Attach the volume directory for the volume containing the file. The volume directory is an Advanced Revelation file called REVMEDIA. For example, if the file is on a volume called SALES_DATA, the TCL command would be:


ATTACH SALES_DATA REVMEDIA


_ Bring the proper volume directory record up in the editor. Each file on the volume has a record in the volume directory that is identified by a two-part key. The first part of the key is the filename, and the second part is the name of the account that the file is in. If the indexed file is the CUSTOMERS file in the account SALES, the TCL command would be:


EDIT REVMEDIA CUSTOMERS*SALES


_ Edit line two of the volume directory entry to remove SI.MFS. If line two has just SI.MFS on it, you can delete it by pressing [Ctrl-X]. If there are other MFSs on the file, use the [Delete] key to delete SI.MFS and the trailing value mark, if any.

_ Press [F9] to save the change, then press [Esc] to exit the editor.


Deleting the Indexing File


If the indexing file (!filename, not !INDEXING) still exists, it must be deleted. To delete the file, follow these steps:

_ Log to the account to which the file belongs. Continuing with the example above, you need to log to the SALES account. From level one of TCL you can enter this command: LOGTO SALES

_ Attach the volume that holds the file:

ATTACH SALES_DATA

_ Delete the indexing file:

DELETEFILE !CUSTOMERS


Updating the Dictionary


The indexing system maintains a variety of information in the dictionary record of an indexed field. Depending on the type on indexing, different information is maintained. You will have to edit the dictionary record for each field in the file that was indexed: Warning! Do not use [Ctrl-D] (delete a line) or press [Enter] while editing a dictionary record. This will alter the dictionary record, making it unusable. To edit a dictionary record, enter from TCL:


EDIT DICT.FILENAME FIELDNAME


Btree Indexes


Field 6 of each dictionary record tells the system whether or not this field has a Btree index. If there is a 1 in this field, the field has had a Btree index installed. Change the 1 to a 0 and save the record.


Cross Reference Indexes


When a Cross Reference index is placed on a field, a symbolic field is created to maintain the index. This field can be identified by the .XREF extension. Because this field is no longer required, it should be deleted. If a cross reference index is placed on the field again, the symbolic field will be recreated. In addition, a field with a Cross Reference index has the name of the cross reference symbolic in field 22 of the dictionary record. Position the cursor on line 22 of the dictionary record, press [Ctrl-X], and save the record.


Relational Indexes


Relational indexes use several fields in the dictionary record to store their control information. In the record that serves as the target of the relational index, change the 1 on line 25, which tells the system that this field's data is protected, to a 0. Line 24 contains the name of the relational index, which should be cleared with [Ctrl-X]. To completely remove the Relational index, the dictionary of the source file must also be edited. In that dictionary, the source field will have the name of the related field on line 23. Remove the name with[Ctrl-X].


Final Steps In Advanced Revelation 2.0 and higher


There are two other records in the dictionary that should be deleted: %PROTECT.SPEC% and %FIELDS%. Delete these fields after editing the indexed fields. Reattach the file and the system will recreate these records, reflecting the changes made to the dictionary. At this point the file has had all indexing removed. Indexes can be re-established as necessary.