Skip to content

FILE

Define a File from File Identification

This directive defines a file using a string in the format of the FID or XFD function that contains the file parameters. The file is defined and an entry is made in the logical disk directory. MSORT, TEXT, and TISAM file types require the XFD function option 5 format.

FILE string-value [,ERR=line-ref|,ERC=error-code])
string-value
is a string in the format of the FID or XFD function containing the file parameters.
line-ref
is the program line number or label to branch to if this directive produces an error.
error-code
is a programmer-defined error code. Valid values are positive or negative whole numbers.

This directive should only be used for files, not for logical disk directories, tasks, or devices.

See the FID and XFD functions for the proper format of string-value in a given environment.

If an attempt is made to define a file having the same name as another file in an available logical disk directory, an ERR=12 results.

The FILE directive requires an XFD function option 5 string format (as opposed to FID function) for MSORT, TEXT, and TISAM file types.

OPEN (1) FILE_NAME$
LET A$=FID (1)
CLOSE (1)
ERASE FILE_NAME$
FILE A$

effectively erases the contents of the file whose name is in FILE_NAME$, then recreates it at the same size as before with no data, provided that the file type is not MSORT, TEXT, or TISAM.

INITFILE directive, FID, and XFD functions

From the Thoroughbred Basic Language Reference, Volume II: F–Q, version 8.9.1. Open this page in the PDF