Format 1 (Sequential File Entries)
->->---SELECT-----*----------*-------------file-name------------>
*-OPTIONAL-*
*--------------------*
V +
->--ASSIGN-*--*-*--assignment-name-1-*------------------------>
*TO* *--literal-1---------*
->--*--------------------------*------------------------------>
*-RESERVE integer-*-------**
*-AREA--*
*-AREAS-*
->--*--------------------------------*------------------------>
*-*-----------------*-SEQUENTIAL-*
*-ORGANIZATION*--**
*IS*
->----------*----------------------------*-------------------->
*-ACCESS*----**--*SEQUENTIAL-*
*MODE**IS*
->---*--------------------------------------------*--. -------><-
**----*STATUS*--*data-name-1-*-------------*-*
*FILE* *IS* *-data-name-5-*
Format 2 (Indexed File Entries)
->->---SELECT--file-name-------------------------------------->
*--------------------*
V +
->--ASSIGN-*--*-*--assignment-name-1-*---------------------->
*TO* *--literal-1---------*
->----*--------------------------*-------------------------->
*-RESERVE integer-*-------**
*-AREA--*
*-AREAS-*
->--*-----------------*---INDEXED--------------------------->
*-ORGANIZATION*--**
*IS*
->---*--------------------------------*--------------------->
*-ACCESS*----**--**-SEQUENTIAL-*-*
*MODE**IS**-RANDOM-----*
*-DYNAMIC----*
->--RECORD--*---*--*--*--*--EXTERNALLY-DESCRIBED-KEY--*----->
*KEY* *IS* *--data-name-2---------------*
->---*-----------------------*------------------------------> *-*------*--DUPLICATES--*
*-WITH-*
->--*---------------------------------------------*-. ------><-
**----*STATUS*--*-data-name-1-*-------------*-*
*FILE* *IS* *-data-name-5-*
Format 3 (Relative File Entries)
->->---SELECT---file-name---------------------------------------->
*--------------------*
V +
->--ASSIGN-*--*-*--assignment-name-1-*------------------------->
*TO* *--literal-1---------*
->----*--------------------------*----------------------------->
*-RESERVE integer-*-------**
*-AREA--*
*-AREAS-*
->--*-----------------*----RELATIVE---------------------------->
*-ORGANIZATION*--**
*IS*
->-*---------------------------------------------------------*->
*ACCESS*----**--**SEQUENTIAL*----------------------------**
*MODE**IS*+ *RELATIVE*---**--*data-name-4*
+ *KEY**IS* +
**-RANDOM--*RELATIVE*---**--*data-name-4*
*-DYNAMIC-* *KEY**IS*
->--*--------------------------------------------*-. ----------><-
**----*STATUS*--*data-name-1-*-------------*-*
*FILE* *IS* *-data-name-5-*
Format 4 (Sort or Merge File Entries)
->->---SELECT---file-name------------------------------------->
*--------------------*
V +
->--ASSIGN-*--*-*--assignment-name-1-*-. -------------------><-
*TO* *--literal-1---------*
Format 5 (TRANSACTION File Entries)
->->---SELECT---file-name---------------------------------------->
*--------------------*
V +
->--ASSIGN-*--*-*--assignment-name-1-*------------------------->
*TO* *--literal-1---------*
->--*-----------------*----TRANSACTION------------------------->
*-ORGANIZATION*--**
*IS*
->-*---------------------------------------------------------*->
*ACCESS*----**--**SEQUENTIAL------------------------------*
*MODE**IS**DYNAMIC--RELATIVE-*---**--*-data-name-3-*
*KEY**IS*
->--*--------------------------------------------*------------->
**----*STATUS*--*data-name-1-*-------------*-*
*FILE* *IS* *-data-name-5-*
->--*------------------------------------*-. ------------------><-
*-CONTROL-AREA--*----*--data-name-6--*
*-IS-*
The SELECT clause chooses a file in the COBOL program to be associated with an external medium.
When file-name specifies a sort or a merge file, only the ASSIGN clause may follow the SELECT clause.
You may specify SELECT OPTIONAL 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 present each time the object program is executed.
File-name must be an FD or SD entry in the Data Division. 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 specifies a sort or a merge file, only the ASSIGN clause may follow the SELECT clause.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.