tips:revmedia:subs1

BATCH.INDEXING

Published ByDateVersionKnowledge LevelKeywords
Revelation Technologies14 NOV 19892.XEXPERTBATCH.INDEXING,

The BATCH.INDEXING subroutine reduces overhead for the Advanced Revelation indexing process, which is useful for batch processes.

BATCH.INDEXING(mode, filevar) 

Normally, when the system writes a data record to an indexed file, it must also write a transaction record to the !INDEXING file. You can make this process somewhat more efficient by buffering the write process in memory using BATCH.INDEXING.

BATCH.INDEXING either buffers a set amount of data (1,000 bytes) or buffers for a limited time (5 seconds), whichever occurs first, so you need not be concerned with overrunning memory space.

An argument for mode turns BATCH.INDEXING on or off. A "1" here starts buffering and a "0" stops it, at which time the buffered data is written out to !INDEXING.

Filevar is the file variable of the indexed file. An argument is required when beginning the batch process.

No values are returned.

/* The following code opens a file, turns on the batch  
indexing function, writes records to the opened file, then  
turns off the buffering process.  The internal subroutines  
included here are dummies, which in practice would be  
replaced by proper record processing routines. */ 
 
DECLARE SUBROUTINE BATCH.INDEXING, FSMSG 
 
EQUATE start_buffer$ TO 1 
EQUATE stop_buffer$  TO 0 
 
file = "SAMPLE_CUSTOMERS" 
done = 0 
 
OPEN file TO filevar ELSE FSMSG(); STOP 
PERFORM "SELECT ":file 
 
BATCH.INDEXING(start_buffer$, filevar) 
 
LOOP 
    GOSUB build_records 
  UNTIL done 
    GOSUB write_records 
REPEAT 
 
BATCH.INDEXING(stop_buffer$, "") 
STOP 
 
******************** 
Internal Subroutines 
******************** 
 
build_records: 
READNEXT @ID ELSE done = 1; RETURN 
READ @RECORD FROM filevar, @ID ELSE FSMSG(); STOP 
IF @RECORD<<5>> = "Dallas" THEN 
    phone = @RECORD<<3>> 
    @RECORD<<3>> = "214 ":phone 
    @ID = "X":@ID 
END 
RETURN 
 
write_records: 
WRITE @RECORD ON filevar, @ID ELSE FSMSG(); STOP 
RETURN 
  • tips/revmedia/subs1.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1