The SELECT clause identifies a file in the COBOL program
to be associated with an external file.
- SELECT OPTIONAL
- Can be specified only for files opened in the input, I-O, or extend mode. You must
specify SELECT OPTIONAL for those input files that are not necessarily available each time
the object program is executed. For more information, see
OPEN statement notes.
- file-name-1
- Must be identified by an FD or SD entry in the data division. A file-name must
conform to the rules for a COBOL user-defined name, must contain at least one alphabetic
character, and must be unique within this program.
When file-name-1 specifies a sort or a merge file, only the ASSIGN clause can
follow the SELECT clause.
If the file connector referenced by file-name-1 is an external file connector, all file-control entries in the run
unit that reference this file connector must have the same specification for the OPTIONAL
phrase.