COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
SELECT clause
OPTIONAL
makes the file optional, which means that an OPEN statement with an INPUT, I-O, or
EXTEND phrase can open the file whether or not the file exists. If the file exists, its I-O status
code is “00”; if not, its I-O status code is “05”. OPTIONAL does not affect the OPEN
statement with an OUTPUT phrase.
When you open a nonexistent optional file for input, the first READ statement for that file
uses the AT END option (or USE procedure if the READ statement has no AT END phrase).
file-name
is the COBOL file-name (the file-name in a file description entry).
ASSIGN clause
associates file-name with a file designated by system-file-name, or
define-name-literal. Only the first system-file-name or define-name-literal
has meaning. The compiler ignores subsequent names and literals and issues a warning.
system-file-name
is the name of a disk file or either of the special operating system file names #DYNAMIC
or #TEMP, described in System-Names (page 65). system-file-name must be enclosed
in quotation marks unless it begins with a dollar sign ($), a backward slash (\), or a number
sign (#), or is a COBOL word. If system-file-name is #TEMP, the file cannot have
alternate keys. For more information about operating system file names, see the Guardian
Procedure Calls Reference Manual.
132 Environment Division










