These file statements work on all types of files.
u CLOSE
CLOSE #ch
Parameters
ch is the file channel associated with the file when it was opened.
Comments
Closing a file releases any internal locks on it. It has no effect on external locking mechanisms such as XLOCK and FLOCK.
All open files are automatically closed at the end of a program.
Attempting to explicitly close a file channel which is not open generates ASB error #14 (I/O to unopened file). You can determine if a file channel is open by using the ERF(ch) function.
|
u KILL
Updated July 2015; Comment added
KILL fspec
KILL erases/deletes a file.
Parameters
fspec is filespec in native or AMOS format. If no extension is specified, .DAT is assumed. Terminate the filespec with a dot to erase a file with no extension.
Comments
If the file does not exist, the statement behaves like a null operation—i.e., no error is triggered. So there is no particular need to do a LOOKUP prior to a KILL.
|
u LOOKUP
LOOKUP fspec, blks
LOOKUP checks for size and existence of a file.
Parameters
fspec is a filespec in native or AMOS format. Default extension is .DAT.
blks is a floating point variable which returns the size of the file in "blocks" (512 bytes). Adding further to the confusion of the archaic units, if the file is an exact multiple of 512 bytes, the number of blocks will be reported as a negative value, indicating a "random" file; otherwise it will be a positive number. See the system option ABSLOOKUP to override that behavior. If the file does not exist, the return value is 0. If the file exists but has zero bytes, the return value is 0.5.
See Also
|