Defining line-sequential files and records in COBOL
Use the FILE-CONTROL
paragraph in the ENVIRONMENT
DIVISION
to define the files in a COBOL program as line-sequential
files, and to associate the files with the corresponding external
file-names (ddnames or environment variable names).
An external file-name is the name by which a file is
known to the operating system. In the following example, COMMUTER-FILE
is
the name that your program uses for the file; COMMUTR
is
the external name:
FILE-CONTROL.
SELECT COMMUTER-FILE
ASSIGN TO COMMUTR
ORGANIZATION IS LINE SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS ECODE.
The ASSIGN
assignment-name clause
must not include an organization field (S-
or AS-
)
before the external name. The ACCESS
phrase and the FILE
STATUS
clause are optional.