Next: INPUT PROGRAM, Previous: END FILE, Up: Data Input and Output
For text files:
FILE HANDLE handle_name
/NAME='file-name'
[/MODE=CHARACTER]
/TABWIDTH=tab_width
For binary files with fixed-length records:
FILE HANDLE handle_name
/NAME='file-name'
/MODE=IMAGE
[/LRECL=rec_len]
To explicitly declare a scratch handle:
FILE HANDLE handle_name
/MODE=SCRATCH
Use FILE HANDLE to associate a file handle name with a file and its attributes, so that later commands can refer to the file by its handle name. Names of text files can be specified directly on commands that access files, so that FILE HANDLE is only needed when a file is not an ordinary file containing lines of text. However, FILE HANDLE may be used even for text files, and it may be easier to specify a file's name once and later refer to it by an abstract handle.
Specify the file handle name as the identifier immediately following the FILE HANDLE command name. The identifier INLINE is reserved for representing data embedded in the syntax file (see BEGIN DATA) The file handle name must not already have been used in a previous invocation of FILE HANDLE, unless it has been closed by an intervening command (see CLOSE FILE HANDLE).
MODE specifies a file mode. In CHARACTER mode, the default, the data file is read as a text file, according to the local system's conventions, and each text line is read as one record. In CHARACTER mode, most input programs will expand tabs to spaces (DATA LIST FREE with explicitly specified delimiters is an exception). By default, each tab is 4 characters wide, but an alternate width may be specified on TABWIDTH. A tab width of 0 suppresses tab expansion entirely.
In IMAGE mode, the data file is opened in ANSI C binary mode. Record length is fixed, with output data truncated or padded with spaces to the record length. LRECL specifies the record length in bytes, with a default of 1024. Tab characters are never expanded to spaces in binary mode. Records
The NAME subcommand specifies the name of the file associated with the handle. It is required in CHARACTER and IMAGE modes.
The SCRATCH mode designates the file handle as a scratch file handle. Its use is usually unnecessary because file handle names that begin with `#' are assumed to refer to scratch files. see File Handles, for more information.