COBOL/400 Language Help

FILE-CONTROL Paragraph

Sequential File Entries

Description
The FILE-CONTROL paragraph associates each file in the COBOL program with an external medium, and specifies file organization, access mode, and other information.
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-*

Indexed File Entries

Description
The FILE-CONTROL paragraph associates each file in the COBOL program with an external medium, and specifies file organization, access mode, and other information.
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-*

Relative File Entries

Description
The FILE-CONTROL paragraph associates each file in the COBOL program with an external medium, and specifies file organization, access mode, and other information.
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-*

Sort or Merge File Entries

Description
The FILE-CONTROL paragraph associates each file in the COBOL program with an external medium, and specifies file organization, access mode, and other information.
Format 4 (Sort or Merge File Entries)
 
->->---SELECT---file-name------------------------------------->
 
                *--------------------*
                V                    +
 ->--ASSIGN-*--*-*--assignment-name-1-*-. -------------------><-
           *TO* *--literal-1---------*

TRANSACTION File Entries

Description
The FILE-CONTROL paragraph associates each file in the COBOL program with an external medium, and specifies file organization, access mode, and other information.
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-*
 

SELECT

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.

OPTIONAL

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

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.


[ Top of Page | Previous Page | Next Page | Table of Contents ]