SELECT Clause

The SELECT clause chooses a file.

SELECT Clause - Format - Sequential & Relative Files

Read syntax diagramSkip visual syntax diagramSELECTOPTIONALfile-name

SELECT Clause - Indexed, Sort/Merge, & Transaction Files

Read syntax diagramSkip visual syntax diagramSELECTfile-name
SELECT OPTIONAL (Format Sequential & Relative Files)
May be specified only for sequential and relative files opened in the input, I-O or extend mode. You must specify SELECT OPTIONAL for such input files that are not necessarily present each time the object program is executed.
file-name
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.