In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
Home page Home page Home page Home page
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel

Index Sub Revisited

One of the most popular articles in Volume 1 of REVMEDIA was that explaining the use of the undocumented routine MAKE.INDEX to manipulate indexes on files. The first utility diskette contained a routine called INDEX.SUB which used MAKE.INDEX and INDEXING to simplify all handling of indexes.

With the release of 2.0, RevTech have changed the way in which both of these routines work. This article reflects these changes and explains how to modify the INDEX.SUB code to cope with the new release.

Adding XREF Indexes

Whilst the old "A" call to add XREF indexes seems to work, an index rebuild does not work on an XREF index created in this manner. This is because RevTech have rationalised the way in which the system treats symbolic btrees. Whereas previously the .XREF dictionary item did not require a flag in field six indicating that it was btreed, version 2.0 insists that this be present. Thus the MAKE.XREF.DICT portion of INDEX.SUB must be modified to take account of this as follows.

0001            MAKE.XREF.DICT:
0002                 DICT.REC = "S"
0003                 DICT.REC<3> = ITEM : ".XREF"
0004                 DICT.REC<4> = "M"
0005                 DICT REF<6> = 1 <---------- NEW!!
0006                 DICT.REF<8> = "CALL XREF(.............. (as before)
               DICT.REF<9> - "
L" : @FM : 10

Rebuilding Indexes

The INDEXING subroutine has been modified so that it looks for its input in @PSEUDO rather than in @SENTENCE. The structure of @PSEUDO must be

          @PSEUDO<1>= FILENAME
          @PSEUDO<2>= ITEMNAME
          @PSEUDO<3>= B for BTREE
                      C for Cross Reference
                      R for Relational

The relevant sections of INDEX.SUB should be modified as follows

0001            CASE ACTION = "B"
0002                 *Rebuild a btree
0003                 @PSEUDO = FILE : @FM : ITEM : @FM : "B"


0001                 *Rebuild an XREF
0002                 @PSEUDO = FILE : @FM : ITEM : @FM : "C"


0001                 *Rebuild a relational
0002                 @PSEUDO = FILE : @FM : ITEM : @FM : "R"
0003                 CALL INDEXING ("TCL")

(Volume 2, Issue 4, Page 4)
Pixel Footer R1 C1 Pixel