Example: FILE-CONTROL entries

The following table shows example FILE-CONTROL entries for a QSAM sequential file, a VSAM indexed file, and a line-sequential file.

Table 1. FILE-CONTROL entries
QSAM file VSAM file Line-sequential file

SELECT PRINTFILE1
   ASSIGN TO UPDPRINT2
   ORGANIZATION IS SEQUENTIAL3
   ACCESS IS SEQUENTIAL.4

SELECT COMMUTER-FILE1
   ASSIGN TO COMMUTER2
   ORGANIZATION IS INDEXED3
   ACCESS IS RANDOM4
   RECORD KEY IS COMMUTER-KEY5
   FILE STATUS IS5
      COMMUTER-FILE-STATUS
      COMMUTER-VSAM-STATUS.

SELECT PRINTFILE1
   ASSIGN TO UPDPRINT2
   ORGANIZATION IS LINE SEQUENTIAL3
   ACCESS IS SEQUENTIAL.4
  1. The SELECT clause chooses a file in the COBOL program to be associated with an external data set.
  2. The ASSIGN clause associates the program's name for the file with the external name for the actual data file. You can define the external name with a DD statement or an environment variable.
  3. The ORGANIZATION clause describes the file's organization. For QSAM files, the ORGANIZATION clause is optional.
  4. The ACCESS MODE clause defines the manner in which the records are made available for processing: sequential, random, or dynamic. For QSAM and line-sequential files, the ACCESS MODE clause is optional. These files always have sequential organization.
  5. For VSAM files, you might have additional statements in the FILE-CONTROL paragraph depending on the type of VSAM file you use.