Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

4.2.1 FILE-CONTROL Paragraph



The FILE-CONTROL paragraph associates each file in the COBOL program with an external data set, and specifies file organization, access mode, and other information.

The following are the formats for the FILE-CONTROL paragraph:

Table 9 lists the different type of files available to mainframe and workstation COBOL programs.


 Table 9. Types of Files                                                   
              
     File     
 Organization 
               
 Access Method 
 OS/390 and VM 
                File Systems                
      AIX           OS/2          Windows   
 Sequential   
              
 QSAM, VSAM    
               
 VSAM(1), STL 
              
 VSAM,        
 Btrieve, STL 
 VSAM(2),     
 Btrieve, STL 
 Relative     
              
 VSAM          
               
 VSAM(1), STL 
              
 VSAM,        
 Btrieve, STL 
 VSAM(2),     
 Btrieve, STL 
 Indexed      
              
 VSAM          
               
 VSAM(1), STL 
              
 VSAM,        
 Btrieve, STL 
 VSAM(2),     
 Btrieve, STL 
RevisionX  Line         
RevisionX  Sequential   
RevisionX  n/a           
RevisionX                
RevisionX  Native       
RevisionX               
RevisionX  Native       
RevisionX               
RevisionX  Native       
RevisionX               
 Note:                                                                     
                                                                           
 (1) On AIX, you can access the SFS file system through VSAM.              
                                                                           
 (2) On Windows, only remote file access is available.                     


The FILE-CONTROL paragraph begins with the word "FILE-CONTROL", followed by a separator period. It must contain one and only one entry for each file described in an FD or SD entry in the Data Division. Within each entry, the SELECT clause must appear first. The other clauses can appear in any order.


X >_Host_> Under OS/390 and VM, there is one exception to the rule about
X order. For indexed files, the PASSWORD clause, if specified, must
X immediately follow the RECORD KEY or ALTERNATE RECORD KEY data-name with
X which it is associated. <_Host_<


    ___ Format 1--Sequential-File-Control-Entries ____________________________________________________ 
   |                                                                                                  |
   |                                                          <___________________                    |
   | >>__SELECT__ __________ __file-name-1__ASSIGN__ _ ____ ____assignment-name-1_|_ _______________> |
   |             |_OPTIONAL_|                       | |_TO_|                        |                 |
   |                                                |                        (1)    |                 |
   |                                                |_ USING __ data-name-9 ________|                 |
   |                                                                                                  |
   | >__ _____________________________ __ ______________________________________ ___________________> |
   |    |_RESERVE__integer__ _______ _|  |_ ______________________ __SEQUENTIAL_|                     |
   |                        |_AREA__|      |_ORGANIZATION__ ____ _|                                   |
   |                        |_AREAS_|                      |_IS_|                                     |
   |                                                                                                  |
   | >__ _________________________________________________ _________________________________________> |
   |    |_PADDING__ ___________ __ ____ __ _data-name-5_ _|                                           |
   |               |_CHARACTER_|  |_IS_|  |_literal-2___|                                             |
   |                                                                                                  |
   | >__ _________________________________________________ _________________________________________> |
   |    |_RECORD DELIMITER__ ____ __ _STANDARD-1________ _|                                           |
   |                        |_IS_|  |_assignment-name-2_|                                             |
   |                                                                                                  |
   | >__ ______________________________________ ____________________________________________________> |
   |    |_ACCESS__ ______ __ ____ __SEQUENTIAL_|                                                      |
   |              |_MODE_|  |_IS_|                                                                    |
   |                                                                                                  |
   | >__ ________________________________________________________________________________ __________> |
   |    |        (2)                                                                     |            |
   |    |_ LOCK _____ ________ __ ______ __ AUTOMATIC __ ______________________________ _|            |
   |                 |_ MODE _|  |_ IS _|               |_ ________ __ LOCK ON RECORD _|              |
   |                                                      |_ WITH _|                                  |
   |                                                                                                  |
   | >__ _____________________________________ _____________________________________________________> |
   |    |_ PASSWORD __ ______ __ data-name-6 _|                                                       |
   |                  |_ IS _|                                                                        |
   |                                                                                                  |
   | >__ __________________________________________________________ __.____________________________>< |
   |    |_ ______ __STATUS__ ____ __data-name-1__ _______________ _|                                  |
   |      |_FILE_|          |_IS_|               |_ data-name-8 _|                                    |
   |                                                                                                  |
   | Notes:                                                                                           |
 X | (1)  The USING data-name phrase of the ASSIGN clause clause is only valid under AIX, OS/2, and   |
 X |      Windows.                                                                                    |
   |                                                                                                  |
 X | (2)  The LOCK clause is only meaningful for OS/2 VSAM files.  It is treated as a comment on AIX, |
 X |      Windows, and files other than VSAM on OS/2.  It is invalid on OS/390 and VM.                |
   |                                                                                                  |
   |__________________________________________________________________________________________________|


    ___ Format 2--Indexed-File-Control-Entries _______________________________________________________ 
   |                                                                                                  |
   |                                                          <___________________                    |
   | >>__SELECT__ __________ __file-name-1__ASSIGN__ _ ____ ____assignment-name-1_|_ _______________> |
   |             |_OPTIONAL_|                       | |_TO_|                        |                 |
   |                                                |                        (1)    |                 |
   |                                                |_ USING __ data-name-9 ________|                 |
   |                                                                                                  |
   | >__ _____________________________ __ ______________________ __INDEXED__________________________> |
   |    |_RESERVE__integer__ _______ _|  |_ORGANIZATION__ ____ _|                                     |
   |                        |_AREA__|                    |_IS_|                                       |
   |                        |_AREAS_|                                                                 |
   |                                                                                                  |
   | >__ __________________________________________ ________________________________________________> |
   |    |_ACCESS__ ______ __ ____ __ _SEQUENTIAL_ _|                                                  |
   |              |_MODE_|  |_IS_|  |_RANDOM_____|                                                    |
   |                                |_DYNAMIC____|                                                    |
   |                                                                                                  |
   | >__ ________________________________________________________________________________ __________> |
   |    |        (2)                                                                     |            |
   |    |_ LOCK _____ ________ __ ______ __ AUTOMATIC __ ______________________________ _|            |
   |                 |_ MODE _|  |_ IS _|               |_ ________ __ LOCK ON RECORD _|              |
   |                                                      |_ WITH _|                                  |
   |                                                                                                  |
   | >__RECORD__ _____ __ ____ __data-name-2__ _____________________________________ _______________> |
   |            |_KEY_|  |_IS_|               |_ PASSWORD __ ______ __ data-name-6 _|                 |
   |                                                        |_ IS _|                                  |
   |                                                                                                  |
   |    <_________________                                                                            |
   | >____ _____________ _|__ __________________________________________________________ __._______>< |
   |      |_| entry 1 |_|    |_ ______ __STATUS__ ____ __data-name-1__ _______________ _|             |
   |                           |_FILE_|          |_IS_|               |_ data-name-8 _|               |
   |                                                                                                  |
   | entry 1:                                                                                         |
   |                     (3)                                                                          |
   | |__ALTERNATE RECORD_____ _____ __ ____ __data-name-3__ ______________________ _________________> |
   |                         |_KEY_|  |_IS_|               |_ ______ __DUPLICATES_|                   |
   |                                                         |_WITH_|                                 |
   |                                                                                                  |
   | >__ _____________________________________ _____________________________________________________| |
   |    |_ PASSWORD __ ______ __ data-name-7 _|                                                       |
   |                  |_ IS _|                                                                        |
   |                                                                                                  |
   | Notes:                                                                                           |
 X | (1)  The USING data-name phrase of the ASSIGN clause is only valid under AIX, OS/2, and Windows. |
   |                                                                                                  |
 X | (2)  The LOCK clause is only meaningful for OS/2 VSAM files.  It is treated as a comment on AIX, |
 X |      Windows, and files other than VSAM on OS/2.  It is invalid on OS/390 and VM.                |
   |                                                                                                  |
 X | (3)  RECORD is optional as an IBM extension.                                                     |
   |                                                                                                  |
   |__________________________________________________________________________________________________|


    ___ Format 3--Relative-File-Control-Entries ______________________________________________________ 
   |         :                                                                                        |
   |                                                          <___________________                    |
   | >>__SELECT__ __________ __file-name-1__ASSIGN__ _ ____ ____assignment-name-1_|_ _______________> |
   |             |_OPTIONAL_|                       | |_TO_|                        |                 |
   |                                                |                        (1)    |                 |
   |                                                |_ USING __ data-name-9 ________|                 |
   |                                                                                                  |
   | >__ _____________________________ __ ______________________ __RELATIVE_________________________> |
   |    |_RESERVE__integer__ _______ _|  |_ORGANIZATION__ ____ _|                                     |
   |                        |_AREA__|                    |_IS_|                                       |
   |                        |_AREAS_|                                                                 |
   |                                                                                                  |
   | >__ ______________________________________________________________________________________ ____> |
   |    |_ACCESS__ ______ __ ____ __ _SEQUENTIAL__ ________________________________________ _ _|      |
   |              |_MODE_|  |_IS_|  |             |_RELATIVE__ _____ __ ____ __data-name-4_| |        |
   |                                |                         |_KEY_|  |_IS_|                |        |
   |                                |_ _RANDOM__ __RELATIVE__ _____ __ ____ __data-name-4____|        |
   |                                  |_DYNAMIC_|            |_KEY_|  |_IS_|                          |
   |                                                                                                  |
   | >__ ________________________________________________________________________________ __________> |
   |    |        (2)                                                                     |            |
   |    |_ LOCK _____ ________ __ ______ __ AUTOMATIC __ ______________________________ _|            |
   |                 |_ MODE _|  |_ IS _|               |_ ________ __ LOCK ON RECORD _|              |
   |                                                      |_ WITH _|                                  |
   |                                                                                                  |
   | >__ _____________________________________ _____________________________________________________> |
   |    |_ PASSWORD __ ______ __ data-name-6 _|                                                       |
   |                  |_ IS _|                                                                        |
   |                                                                                                  |
   | >__ __________________________________________________________ __.____________________________>< |
   |    |_ ______ __STATUS__ ____ __data-name-1__ _______________ _|                                  |
   |      |_FILE_|          |_IS_|               |_ data-name-8 _|                                    |
   |                                                                                                  |
   | Notes:                                                                                           |
 X | (1)  The USING data-name phrase of the ASSIGN clause is only valid under AIX, OS/2, and Windows. |
   |                                                                                                  |
 X | (2)  The LOCK clause is only meaningful for OS/2 VSAM files.  It is treated as a comment on AIX, |
 X |      Windows, and files other than VSAM on OS/2.  It is invalid on OS/390 and VM.                |
   |                                                                                                  |
   |__________________________________________________________________________________________________|


 X  ___ Format 4--Line Sequential I-O (Workstation Only) ______________________________ 
 X |                                                                                   |
 X | >>__SELECT__ __________ __file-name-1___________________________________________> |
 X |             |_OPTIONAL_|                                                          |
   |                                                                                   |
 X |                      <___________________                                         |
 X | >__ASSIGN__ _ ____ ____assignment-name-1_|_ ____________________________________> |
 X |            | |_TO_|                        |                                      |
 X |            |_USING__data-name-9____________|                                      |
   |                                                                                   |
 X | >__ ______________________ __LINE SEQUENTIAL____________________________________> |
 X |    |_ORGANIZATION__ ____ _|                                                       |
 X |                    |_IS_|                                                         |
   |                                                                                   |
 X | >__ ______________________________________ _____________________________________> |
 X |    |_ACCESS__ ______ __ ____ __SEQUENTIAL_|                                       |
 X |              |_MODE_|  |_IS_|                                                     |
   |                                                                                   |
 X | >__ ________________________________________________________ __._______________>< |
 X |    |_ ______ __STATUS__ ____ __data-name-1__ _____________ _|                     |
 X |      |_FILE_|          |_IS_|               |_data-name-8_|                       |
   |                                                                                   |
   |___________________________________________________________________________________|


Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.