Development Topics > Appendix > Pre-Defined Functions

File-Related Functions

Function

Description

EOF

EOF(X) returns end-of-file status for file channel X: -1 if no file is open on channel X; 0 if file is open but end-of-file has not been reached; 1 if end-of-file has been reached (after some form of INPUT statement on a sequential file).

ERF

ERF(X) tests the status of file channel X, depending on the file type. For all file types ERF(X) returns -1 if no file is open on channel X. For sequential input files, ERF(X) returns 1 if the last INPUT operation hit the end of the file. (Note that data may have been returned though.) ERF(X) returns 0 if the file is open and not at the EOF marker. See the table below for values returned by ERF(X) in conjunction with ISAM 1.0 files.  

LOOKUP

LOOKUP (FSPEC$) Returns the size of the specified file in blocks (0 for non-existing, 0.5 for a file with zero bytes). Note that the returned block count for files which appear to be contiguous (are an even multiple of 512 bytes) will be negative, unless you set OPTIONS=ABSLOOKUP in the MIAME.INI. If you don't have control over that option, you may want to use the ABS(X) function on the result in order to confusion with files that happen to be a multiple of 512 bytes with, e.g. ABS(LOOKUP(FSPEC$)).

 

ERF(X) Values for ISAM 1.0 files

Function

Description

14

Illegal record number

32

Illegal ISAM statement code

33

(after ISAM 1) indicates the key was not found

34

(after ISAM 3) duplicate key found during add key

35

link structure smashed

36

(after ISAM 3) index file full (and auto-expansion disabled; see OPTIONS=NOAUTOX.

37

(after ISAM 5) data file full (and auto-expansion disabled).

38

(after ISAM 2 or 7) already at end of index

39

Illegal ISAM sequence (violates LOKSER rules; if program was not designed to work with LOKSER, you can turn LOKSER off with SET NOLOKSER or LOKSER=OFF in the miame.ini)