Subroutine to quickly estimate the number of records in a file.
Assumes all records are same length as the average of the first
ten records in file.
"a" = argument, "r" = referenced, "s" = set
call howlong (with the following arguments)
UnitNumber [variable i*4 r]
NumberRecords [variable i*4 sr]
stringlen (shared DRS external routine)
getmode (shared DRS external routine)
attrib (shared external macro)
fstat (UNIX function)
NOTE -- this subroutine will not work with foreign tapes.
Although this program has been used by the U.S. Geological Survey,
no warranty, expressed or implied, is made by the Survey as to the
accuracy and functioning of the program and related program
material nor shall the fact of distribution constitute any such
warranty, and no responsibility is assured by the Survey in
Ed Maple &
Clint Steele 7/5/84 .for
Ed Maple 8/8/84 Added code to set IntegerPercent to 1 if
it equals 0 after calculations. Will equal
0 if the program calculates less than 50
records in the file.
Ed Maple 8/30/84 Added code to check for file size greater
than 10000 records, and to print a message
recommending running it batch if so. Only
checks if log_mode is interactive.
Ed Maple 9/5/84 Added code to detect when subroutine is run
from a batch job.
Clint Steele 1/9/84 Replaced SPAWN with Attrib
Clint Steele 2/12/85 Modified for MAT
Ed Maple 5/2/85 Moved Attrib call outside of if-then
statement so FileBlocks can be tested for
a value of zero. If it is zero then
IntegerPercent is set to 100.
Jean Riordan 2/11/88 Modified for DRS$SHARE cleanup and UNIX
Clint Steele 9/23/88 Changed returned value from 1% to 100%.
Changed computation of record length
to average of 1st 10 records.
Changed i/o from unit * to 5 and 6.
Clint Steele 11/23/88 Added recognition of BACKGROUND mode
Clint Steele 11/23/88 Changed LOG_MODE to CALL GETMODE
Clint Steele 8/15/91 Commented out "Next time...batch" message
Clint Steele 12/4/95 Remvoed VMS references
Carolyn Degnan 9/23/04 Added implicit none.
read (UnitNumber, '(a)', iostat = Error, end = 101) Record
call stringlen (Record, LengthRecord)
call getmode (Mode)