>
> 1. Does anyone know if there exists an 'finfo' parameter that returns the
> number of sectors used by a file?
Well, the FFILEINFO intrinsic provides:
Item# 91, returns I64, is: Size of file, in bytes (based on EOF,
not actual disk allocation)
And the FLABELINFO intrinsic provides:
Item #49, I64, current size (bytes, based on EOF)
And, "HELP FINFO,all" shows that FINFO item 49 is:
49 BYTE FILE SIZE Integer Current file size
BYTEFILESIZE (in bytes)
Now, a file can be larger than 2 GB, so it isn't clear what FINFO 49 returns
in that case...that's why FFILEINFO item 91 and FLABELINFO item 49
both return a 64-bit integer.
BTW, despite the manual's caveat that FLABELINFO 49 returns information
based on *EOF*, it clearly does a little more work than that *sometimes*.
The "EOF" note in the manual is trying to say:
Hey, we didn't actually implement what you wanted/needed: the ability
to determine how many sectors the file occupies. Instead we give a
quick estimate.
This can lead to annoying problems/mistakes. In short, the answer is
usually correct (within 15 sectors, anyway) for fixed record files that
have no "holes" and whose EOF matches the LIMIT.
For example, here's a problem with FINFO 49:
:build foo;disc=10000,2,2
:listf foo,2
ACCOUNT= SIELER GROUP= SOURCE
FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE----
SIZE TYP EOF LIMIT R/B SECTORS #X MX
FOO 128W FB 0 10000 1 10000 1 2
:calc finfo ("foo", 49)/256
0, $0, %0
So.....how about we all submit an enhancement request to provide an
FINFO/FLABELINFO/FFILEINFO item that returns the actual number of sectors
occupied by a file (i.e., a value guaranteed to match what LISTF/LISTFILE
would report)?
--
Stan Sieler [log in to unmask]
http://www.allegro.com/sieler.html
|