The file control entry names a file and can specify other file-related information.
- The ASSIGN clause specifies the association of the file referenced by file-name-1
to a storage medium. The first assignment takes effect.


Subsequent assignments within any one ASSIGN clause are documentary only.
- The RESERVE clause allows you to specify the required number of input-output
areas.
The RESERVE clause is documentary only, unless the COBOL system documentation
specific to your operating system indicates otherwise.
- The ORGANIZATION clause specifies the logical structure of a file. The file
organization is established at the time a file is created and cannot subsequently
be changed.
- When the FILE STATUS clause is specified, a value is moved by the run-time
system into the data item specified by data-name-2 after the execution of
every statement that references that file either explicitly or implicitly.
This value indicates the status of execution of the statement. (See the topic
I-O Status in the chapter Procedure Division.)
Data-name-3, if specified, is documentary only.
The PASSWORD clause is documentary only.
Use of the reserved word DYNAMIC in an ASSIGN clause indicates that the
value of literal-1 or data-name-1 in that ASSIGN clause is the specified file's
name in the external file-storage environment.
Use of the reserved word EXTERNAL in an ASSIGN clause indicates that external-file-reference
identifies the specified file to the external environment for possible further
mapping to an external file-storage environment-name. (See your COBOL system
documentation on file handling for details on setting up external-file-name
for your particular operating environment.)
If external-file-reference contains the character "-", then only that part
of the name following the last "-" is used to identify the file to the external
environment.
The DISK option without external-file-reference, data-name-1 or literal-1
and without the FROM option, specifies a disk file whose name is given in
a VALUE OF FILE-ID clause in the file description for the file. If that file
description contains no VALUE OF FILE-ID clause, the name of the disk file
is assumed to be the same as file-name-1 (known as the internal file-name).
If any of the keywords DISK, KEYBOARD, DISPLAY, PRINTER or PRINTER-1 are
followed by external-file-reference, data-name-1 or literal-1, that keyword
is ignored.
The DISK option with the FROM option specifies a disk file whose name on
the disk is the value of data-name-1. However, if when an OPEN statement is
executed for that file, data-name-1 contains all spaces, the name of the disk
file is assumed to be the same as file-name-1 (known as the internal-file-name).
- The OPTIONAL phrase applies only to files opened in the INPUT, I-O or EXTEND
mode. Its specification is required for files that are not necessarily present
each time the runtime element is executed.

The SHARING clause specifies the sharing mode to be used for the file unless
it is overridden by the SHARING phrase of the OPEN statement. This clause
also specifies whether record locks have an effect. Additional details are
specified in the topic Sharing Mode in the chapter Language Fundamentals.
The LOCK MODE clause is an optional clause in the file control entry and
is used to specify the locking technique used for the file.
If this clause is omitted, opening the file causes it to become exclusive,
with the exception of OPEN INPUT.
When LOCK MODE IS EXCLUSIVE is specified, the run unit acquires a lock on
the whole file when it opens the file.
When LOCK MODE IS AUTOMATIC or LOCK MODE IS MANUAL is specified, the file
that the run unit opens is shareable. Files opened OUTPUT, and indexed and
relative files opened EXTEND are, however, always exclusive.
The ROLLBACK clause requests transaction logging for a file under those
COBOL systems that support that feature. See your COBOL system documentation
on file handling for details of how it is implemented in your system.
If the ROLLBACK clause is specified then WITH LOCK ON MULTIPLE RECORDS is
automatically in effect.
The WITH LOCK ON RECORD clause specifies single record locking for the file.
The WITH LOCK ON MULTIPLE RECORDS clause specifies multiple record locking
for the file. This clause must be present if multiple record locking is required.
If LOCK MODE IS AUTOMATIC WITH LOCK ON RECORD is specified for a file, a
record lock is acquired by the execution of the READ statement and is released
upon execution of a subsequent I/O operation on this file, with the exception
of a START statement.
If LOCK MODE IS AUTOMATIC WITH LOCK ON MULTIPLE RECORD is specified for a
file, a record lock is acquired by the execution of the READ statement and
is not released until a CLOSE, COMMIT, ROLLBACK or UNLOCK statement is executed,
or until an individual lock is released by a DELETE statement.
If LOCK MODE IS MANUAL WITH LOCK ON RECORD is specified, a lock is acquired
by a READ statement only if it includes the WITH LOCK phrase, and is released
upon execution of a subsequent I/O operation on this file, with the exception
of a START statement.
If LOCK MODE IS MANUAL WITH LOCK ON MULTIPLE RECORDS is specified, a record
lock is acquired by the READ WITH KEPT LOCK statement and is not released
until a CLOSE, COMMIT, ROLLBACK or UNLOCK statement is executed.
When the lock mode is MANUAL or AUTOMATIC, single record locking is assumed
unless the WITH LOCK ON MULTIPLE RECORDS phrase is included.
If a file is defined as EXTERNAL and the operating system file-name is assigned
by means of a file-name, for example, by use of the ASSIGN directive or keyword,
using data-name-1 in the SELECT/ ASSIGN statement, or using Format 2 of the
VALUE OF phrase of an FD, then the following rules should be followed:
- An identifier with the same name should be used to contain the physical file-name
in all source elements which reference the file.
- The definition of the identifier which contains the physical file-name should
also contain the EXTERNAL attribute.
No violation of these rules is detected at compile time, but, if any runtime
element in the run unit violates these rules, the results at run time are
undefined.
For further details of the effects of record locking, see your COBOL system
documentation on file handling.
- The MULTIPLE REEL or MULTIPLE UNIT phrase must be specified if it is possible
or intended that the file can be closed by use of the CLOSE REEL or CLOSE
UNIT statement.
- Records in the file are accessed in the sequence specified by predecessor-successor
record relationships which are established by the execution of WRITE statements
when the file is created or extended.
Using the LINE ADVANCING FILE phrase causes a file suitable for a printer
to be produced. This file has an initial carriage-return character, and each
record is written with AFTER ADVANCING 1 LINE as the default advancing phrase.
See your COBOL system documentation on file handling for further details of
the format.

The PADDING CHARACTER clause is documentary only.
If the associated file connector is an external file connector, all PADDING
CHARACTER clauses in a run unit which are associated with that file connector
must have the same specification. If data-name-5 is external, it must reference
an external data item.

The RECORD DELIMITER clause is documentary only.

When LINE SEQUENTIAL ORGANIZATION is specified either implicitly or explicitly,
the file is treated as consisting of fixed-length records, each containing
one line of data. The records are stored with trailing spaces removed. The
definition of a line of data varies among different operating systems. Some
terminate line records with one or both of the carriage-return and line-feed
characters, and some pad out as fixed length records. Your COBOL system, therefore,
always produces files which are compatible in this respect with the editor
software in any operating system.

The LOCK MODE IS clause is documentary only.
- When access mode is sequential, records in the file are accessed in order
of ascending relative record numbers of existing records in the file.
- When access mode is random, the value of the RELATIVE KEY data item indicates
the record to be accessed.
- All records stored in a relative file are uniquely identified by relative
record numbers, which also specify the record's logical ordinal position in
the file. The first logical record has a relative record number of 1, and
subsequent logical records have relative record numbers of 2, 3, 4, ... .
- The data item specified by data-name-5 is used to communicate a relative
record number between the run-time elementand the operating system.
- When access mode is sequential, records in the file are accessed in order
of ascending record key values within a given key of reference.
- When access mode is random, the value of the record key data item indicates
the record to be accessed.
- The RECORD KEY clause specifies the record key that is the prime record key
for the file. The values of the prime record key must be unique among records
of the file. This prime record key provides an access path to records in an
indexed file.
- If the file has more than one record description entry, data-name-5

and any data-names referenced by split-key-name-1
need be describedonly
in one of these record description entries. The identical character positionsreferenced
by data-name-5

and any data-names referenced by split-key-name-1
in any one record descriptionentry
are implicitly referenced as keys for all other record description entriesof
that file.
If the associated file connector is an external file connector, all file
description entries in the run unit which are associated with that file connector
must specify the same data description entry for data-name-1 with the same
relative location in the associated record.
- The ALTERNATE RECORD KEY clause specifies a record key that is an alternative
record key for the file. This alternate record key provides an alternative
access path to records in an indexed file.
- The data description of data-name-5
or split-key-name-1
and data-name-8
or split-key-name-2,
as well as of relative locations within a record, must be the same as that
used when the file was created. The number of alternate keys for the file
must also be the same as that used when the file was created. This checking
is configurable in some environments. (Look up the KEYCHECK parameter in your
COBOL system documentation.)
- The DUPLICATES phrase specifies that the value of the associated record key
can be duplicated within any of the records in the file. If the DUPLICATES
phrase is not specified, the value of the associated record key must not be
duplicated among any of the records in the file.
- For duplicate values, the correct duplicate entry must be located using sequential
reads from the first duplicate entry.
The SUPPRESS phrase requests the use of a sparse key for an alternate index.
Sparse keys are available only through the File Handler and are not available
on all systems (see your COBOL system documentation on file handling for details).

Split-key-name-1 defines a record key consisting of the concatenation of
data-name-6 and all occurrences of data-name-7 in the order specified. Split-key-name-2
defines a record key consisting of the concatenation of data-name-9 and all
occurrences of data-name-10 in the order specified.
- The file-control entry names a sort or merge file and specifies the association
of the file to a storage medium.
When the SORT STATUS clause is specified, a value is placed into the two-character
data item specified by data-name-2 after the execution of each sort or merge
operation. This value indicates the status at completion of the operation.
The following combinations of status keys are possible. Status key 1=0 and
status key 2=0 indicates successful completion. Status key 1=3 and status
key 2=0 indicates a permanent error. If status key 1=9, status key 2 contains
an operating system error message number. For explanations of status keys
1 and 2 and definitions of status, see the topic I-O Status in the chapter
Procedure Division. The FILE STATUS clause can be used instead of a SORT
STATUS clause, but is treated as a synonym for it, when specified for a sort
or merge file.
- The ASSIGN clause is documentary only.