Table of Contents

GET.RECCOUNT

Published ByDateVersionKnowledge LevelKeywords
Revelation Technologies14 NOV 19892.XEXPERTGET.RECCOUNT

GET.RECCOUNT

GET.RECCOUNT is an external function that counts the number of records in an Advanced Revelation Linear Hash file.

rec_count = GET.RECCOUNT(filevar, valid, force_count)

Using GET.RECCOUNT

This information is available in the header (descriptive block) of all Advanced Revelation files; however a facility is provided to perform an explicit count of the records in the file. This may be necessary for network files that are highly active. For all other files, an accurate count can be determined from information in the header.

GET.RECCOUNT works only with Advanced Revelation Linear Hash files.

filevar

Use filevar to pass the file variable for the source file.

valid

Valid returns true if the file accessed is a Linear Hash file. Otherwise, valid is false.

force_count

Use force_count to pass a true or false value. If true, an explicit record count is performed. This should be used only with highly active network files.

Values returned

GET.RECCOUNT returns the number of records in the file if it was able to access the file. Otherwise, zero (0) is returned. A true or false value is returned in valid, indicating whether the file is a Linear Hash file.

Correct Use of GET.RECCOUNT

/* The following code performs a record count of the 
SAMPLE_CUSTOMERS file, both via the standard method of 
reading the file header, and also by the explicit method, 
where each record currently available is counted. */

DECLARE FUNCTION GET.RECCOUNT
DECLARE SUBROUTINE MSG, FSMSG

EQUATE true$ TO 1
EQUATE false$ TO 0

* Get record count from the file header

file = "SAMPLE_CUSTOMERS"
valid = false$

force.count = false$

OPEN file TO filevar ELSE FSMSG(); STOP

count = GET.RECCOUNT(filevar, valid, force_count)

IF valid ELSE MSG("record count failed","","",""); STOP

no_force = count

* Force an explicit record count

force_count = true$

count = GET.RECCOUNT(filevar, valid, force_count)

force_cnt = count

text     = no_force:" records were counted without forcing"
text<<-1>> = force_cnt:" records were counted when forcing"

MSG(text, "", "", "")