Example: FILE-CONTROL paragraph
The following example shows how the FILE-CONTROL
paragraph
associates each file in the COBOL program with a physical file known
to the file system. This example shows a FILE-CONTROL
paragraph
for an indexed file.
SELECT COMMUTER-FILE (1)
ASSIGN TO COMMUTER (2)
ORGANIZATION IS INDEXED (3)
ACCESS IS RANDOM (4)
RECORD KEY IS COMMUTER-KEY (5)
FILE STATUS IS (5)
COMMUTER-FILE-STATUS
COMMUTER-STL-STATUS.
- (1)
- The
SELECT
clause associates a file in the COBOL program with a corresponding system file. - (2)
- The
ASSIGN
clause associates the name of the file in the program with the name of the file as known to the system.COMMUTER
might be the system file-name or the name of the environment variable whose runtime value is used as the system file-name with optional directory and path names. - (3)
- The
ORGANIZATION
clause describes the organization of the file. If you omit this clause,ORGANIZATION IS SEQUENTIAL
is assumed. - (4)
- The
ACCESS MODE
clause defines the manner in which the records in the file are made available for processing: sequential, random, or dynamic. If you omit this clause,ACCESS IS SEQUENTIAL
is assumed. - (5)
- You might have additional statements in the
FILE-CONTROL
paragraph depending on the type of file and file system you use.