Next: , Previous: , Up: Data Input and Output   [Contents][Index]


8.8 FILE HANDLE

For text files:
        FILE HANDLE handle_name
                /NAME=’file_name
                [/MODE=CHARACTER]
                [/ENDS={CR,CRLF}]
                /TABWIDTH=tab_width
                [ENCODING=’encoding’]

For binary files in native encoding with fixed-length records:
        FILE HANDLE handle_name
                /NAME=’file_name’
                /MODE=IMAGE
                [/LRECL=rec_len]
                [ENCODING=’encoding’]

For binary files in native encoding with variable-length records:
        FILE HANDLE handle_name
                /NAME=’file_name’
                /MODE=BINARY
                [/LRECL=rec_len]
                [ENCODING=’encoding’]

For binary files encoded in EBCDIC:
        FILE HANDLE handle_name
                /NAME=’file_name’
                /MODE=360
                /RECFORM={FIXED,VARIABLE,SPANNED}
                [/LRECL=rec_len]
                [ENCODING=’encoding’]

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).

The effect and syntax of FILE HANDLE depends on the selected MODE:

The NAME subcommand specifies the name of the file associated with the handle. It is required in all modes but SCRATCH mode, in which its use is forbidden.

The ENCODING subcommand specifies the encoding of text in the file. For reading text files in CHARACTER mode, all of the forms described for ENCODING on the INSERT command are supported (see INSERT). For reading in other file-based modes, encoding autodetection is not supported; if the specified encoding requests autodetection then the default encoding is used. This is also true when a file handle is used for writing a file in any mode.


Next: INPUT PROGRAM, Previous: END FILE, Up: Data Input and Output   [Contents][Index]