Use -tablerangesize and -indexrangesize
Code:
define variable i as integer no-undo.
for each _file no-lock where _file-num > 0 and _file-num < 10000:
i = i + 1.
end.
message "set -tablerangesize to at least " i.
i = 0.
for each _index no-lock:
i = i + 1.
end.
message "set -indexrangesize to at least " i.
That will set -indexrangesize higher than you need, as it counts system indexes as well as application indexes. Not that it matters, the only expense is a bit of shared memory. Alternatively, you could count indexes like:
Code:
...
<snip>
i = 0.
for each _index no-lock where not _index-name begins "_":
i = i + 1.
end.
message "set -indexrangesize to at least " i + 7.
This assumes your application doesn't have any indexes whose names begin with an underscore, and -baseindex is 1 (the default). I add 7 because indexes 1 to 7 (_idx-num) are system indexes, and if you don't leave enough slots in _IndexStat then you won't get stats for your last (highest-numbered) seven indexes. I learned that one the hard way.