RTP Series - RTP27
QTIPS - Printing Large Variables from the Debugger
VERBatim - V87
Redefining Keys
RTP Series - RTP53B
Prompt Help
VERBatim - V124
Popups
@ATTACK - @Environ.Set
@ATTACK - @Edit.Keys
@ATTACK - @Int.Const
@ATTACK - @HW
@ATTACK - @Modal
@ATTACK - @Move.Keys
@ATTACK - @Priority.Int
@ATTACK - @Macro.Mode
Utility Diskette # 3 - Part I
Utility Diskette # 3 - Part II
Utility Diskette # 4
Utility Diskette # 3 - Part I
Utility Diskette # 3 - Part II
Utility Diskette # 4
Network Contention
Index Sub Revisited
Rebuilding Indexes
Utility Diskette # 3 - Part I
Utility Diskette # 4
QTIPS - Using @Upper.Case and @Lower.Case with Foreign Languages
@ATTACK - @Lower.Case
@ATTACK - @Upper.Case
Sorting out Collation Sequences by Mike Pope
SecureUser
VERBatim - V25
@ATTACK - @Files.System
Advanced Revelation Initialisation Sequence (Overview) by Mike Pope
REVMEDIA Revisted
Vroom
RTP Series - RTP32
Utility Diskette # 3 - Part I
QTIPS - Menus Without an Action Bar
!File Records
QTIPS - Updating Indexes
Indexing on Xlates
Rebuilding Indexes
How Indexes Are Updated
Index Record Layouts
Index Flush
REVMEDIA Revisited
QTIPS - DOS File Names
DOS Interfacing (Part II)
VERBatim - V116
@ATTACK - @Pri.File
@ATTACK - @Rollout.File
File Variables
How Indexes Are Updated
Index Record Layouts
QTIPS - File Variable of File In SELECT Statement
QTIPS - Amending non-Attached Files
LINEAR HASH FILE STRUCTURES - Part 1
Index Flush
QTIPS - File Handle Structure
Reader's Clinic - Fixing %Windows% Using Depend.Update
QTIPS - Updating Indexes
How Indexes Are Updated
REVMEDIA Revisted
QTIPS - Make.Index 2.11+
RTP Series - RTP5
VERBatim - V22
Play it Again, Cam
Reader's Forum - Mark Hirst Revelation C Interface - Part 1
Reader's Forum - Numeric Precision in R/Basic - Hal Wyman
QTIPS - Use of Mouse
Reader's Forum The C Interface Part 2 - Mark Hirst (Senior Techie - ICS) Reader's Clinic
@ATTACK - @Modal
REVMEDIA Revisted
SecureUser
VERBatim - V86
Advanced Revelation Initialisation Sequence (Overview) by Mike Pope
Make.Index
QTIPS - Btree.Extract
!File Records
Index Sub Revisited
QTIPS - Stop Lists
Reader's Clinic - Stop Lists
Utility Diskette # 4
QTIPS - Manipulating XREF formulae.
Reader's Clinic - Functions and Subroutines
Argument passing - Subroutines and Functions - Mike Pope
QTIPS - Break-On Date Fields
IConvs / OConvs
RTP Series - RTP1
VERBatim - V20
File Variables
Form.List.S
QTIPS - Aesthetically Improving RLIST Reports
QTIPS - Form Processor
QTIPS - Suppressing Initial Form Feed
QTIPS - Using RTP29 In Place of V6
RTP Series - RTP9
DOS Interfacing (Part II)
RTP Series - RTP57
File Variables
Reader's Clinic - Volume Pointer Record
REVMEDIA Revisted
Utility Diskette # 4
DOS Interfacing (Part II)
Reader's Clinic - Preventing Records Being Amended
How Indexes Are Updated
A RevTechie Replies - And Miscellaneous Jottings - Mike Pope - Revelation Technologies (UK) Ltd
Caching in on the Frames Array - Mike Pope
How Indexes Are Updated
QTIPS - Unexpected/Unwanted Modification Of Record On Write
Reader's Clinic - Page Marks in Windows

RevMedia FKB

DocumentV2I8A8
TitleRebuilding Indexes
KeywordsINDEX.FLUSH
INDEX.SUB
REBUILD
INDEX
!INDEXING
TextGordon French of Fort Lauderdale recently asked WITH reference to the
INDEX SUB program included on Utility Diskette Number 1 "How is it possible
to force a rebuild of an index for a file?" The INDEX SUB routine does not
actually force a rebuild as it assumes that you will be REBUILDING after
adding a new index in which case it will work perfectly If however it is
suspected that the INDEXES have become corrupted it can be long winded
calling INDEX SUB to remove readd then rebuild the INDEXES

It is possible to instruct the system to rebuild the index for a field by
mimicking the action taken by the system when it adds an index to a field
The system simply writes a record to the !INDEXING file containing
information about the file to update and the keyword %%ALL IDS%% The
listing below shows a generic routine designed to allow the REBUILDING of
indexes FROM within an RBASIC program To use call WITH the file name and
the field name/index name (EG USER COMPANY_NAME XREF CUST*INV*AR) Note
network users should ensure they incorporate LOCKING logic into this
subroutine

SUBROUTINE REBUILD_INDEX(FILE FIELD)
*
* Author AMcA
* Date Jan 91
* Purpose To rebuild an index for a field
* COPYRIGHT Sprezzatura Ltd 1991 Permission given to
* REVMEDIA subscribers to use in any form

DECLARE SUBROUTINE FSMSG

OPEN "!INDEXING" TO IFILE THEN
GOSUB GET_VOL_INFO
GOSUB UPDATE_INDEX_FILE
END ELSE
FSMSG()
END
RETURN

GET_VOL_INFO:
FILE_REC = XLATE("FILES" FILE "" "X")
VOL_REC = XLATE("VOLUMES" FILE_REC<1> "" "X")
VOL_INFO = FILE_REC<2>:"*":FILE_REC<3>:"*":VOL_REC<1>
RETURN

UPDATE_INDEX_FILE:
UPDATE_REC = VOL_INFO ; * Volume Information
UPDATE_REC<2> = 1 ; * Number of transactions
UPDATE_REC<3> = FIELD ; * Index to update
UPDATE_REC<4> = "%%ALL IDS%%" ; * Rebuild Flag
UPDATE_REC := @FM : @FM : @FM
READ ZERO_REC FROM IFILE "0" ELSE ZERO_REC = @FM
* Ensure there is a trailing field mark
IF INDEX(ZERO_REC @FM 1) ELSE ZERO_REC := @FM
ZERO_REC := UPDATE_REC
WRITE ZERO_REC TO IFILE "0"
CALL INDEX FLUSH(VOL_INFO '')
RETURN


(Volume 2 Issue 8 Page 7)
[revmedia/copyrigh.htm]

Page last modified: 30/01/03