Updated May 2008
INDEXED'STATS #channel, stats'map
INDEXED'STATS fspec, stats'map
INDEXED'STATS retrieves information about an existing file, either based on its open channel number or its filespec. The layout of the stats'map variable depends on the number of type of indexes, which you must therefore know in advance. (If you don't know, you can always use ISMUTL.LIT to retrieve statistical information.)
The stats'map layout is as follows:
MAP1 ISAM'STATS'MAP
MAP2 IS'DATA'DEVICE,B,2,0 ! RAD50 device name of DAT
MAP2 IS'DATA'UNIT,B,2,0 ! Device unit number of DAT
MAP2 IS'REC'SIZE,B,2 ! total record size
MAP2 IS'FREE'RECS,I,4 ! free rec count (100 million)
MAP2 IS'FREE'IDX,I,4 ! free IDX flock count
MAP2 IS'TOT'RECS,I,4 ! total allocated records (100 million)
MAP2 IS'TOT'IDX,I,4 ! total allocated idx blocks
MAP2 IS'TOT'LOADED,I,4 ! # records loaded
MAP2 IS'MIN'FREE'IDX,B,2 ! minimum free idx blocks
MAP2 IS'EXTRA'PCT,B,2 ! extra % idx blocks to allocate
MAP2 IS'CREATE'DATA ! creation date
MAP3 IS'CREATE'MONTH,B,1
MAP3 IS'CREATE'DAY,B,1
MAP3 IS'CREATE'YEAR,B,1
MAP3 IS'CREATE'DOW,B,1
MAP2 IS'SECOND'IDX,B,1 ! number of secondary indices
MAP2 IS'REBUILD'DATA ! rebuild date (not used)
MAP3 IS'REBUILD'MONTH,B,1
MAP3 IS'REBUILD'DAY,B,1
MAP3 IS'REBUILD'YEAR,B,1
MAP3 IS'REBUILD'DOW,B,1
MAP2 IS'RESERVED(8),B,1 ! reserved for expansion
MAP2 IS'PRIMARY'KEY'STATS ! primary key stats
<use same key structures as for ALLOCATE'INDEXED above>
MAP2 IS'SECONDARY'KEY'STATS ! 0 or more secondary keys
<use same key structures as for ALLOCATE'INDEXED above>
MAP2 IS'END,B,2,0 ! marks end of key definitions
Note: When compiling without the /X:# switch, the I,4 variables shown above will have to be changed to B,4. This is an unfortunate side effect of retaining compatibility with the A-BASIC and A-BASICPlus variations of indexed'status under AMOS. Under A-BASIC (OCMPIL and COMPIL), the four-byte fields in the above structure were type B, while under BASICPlus (COMPLP), they were type I. This remains true under A-Shell, but seems even more confusing because A-Shell makes less of a distinction between the two variations of BASIC. (They use the same RUN.LIT and COMPIL.LIT, with the only difference being whether the COMPIL switch /X:# was specified.) Unfortunately, the format of B and I variables is not the same (the low and high words are swapped), so a common bug when migrating older code to use BASIC Extensions is to forget to remap these B,4 variables to I,4, leading to wildly incorrect values. Programmer beware!