COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
The OCCURS clause with a DEPENDING ON phrase defines a variable-size table. For more
information, see OCCURS Clause for Variable-Size Tables (page 214).
Files
A file is the highest structural form. Each file is a collection of records, ordered by the file’s
organization or by record attributes (keys), and maintained upon some storage medium. Use of
the record structure is not limited to files; individual records can exist independently of files.
In COBOL, a file is a group of records. A file has both fixed attributes and dynamic attributes.
Fixed attributes are determined when you create the file, and you cannot change them subsequently.
Dynamic attributes can vary to some extent, depending on the logical specifications that source
programs request when they access the file.
Some attributes are language-specific. Regardless of file system or operating system, COBOL files
have a certain logical structure (organization and access mode). The operating system provides
an additional attribute of a file: an exclusion mode when the file is open.
A COBOL program references a file by its file connector, which contains information about the
file’s attributes. One component of the file connector is the file position indicator, which determines
which record is the next one to be sequentially accessed.
Topics:
• Organization
• Quotation Marks
• Open Mode
• Exclusion Mode
• File Connector
• File Position Indicator
Organization
Organization, which specifies a file’s logical structure, is a fixed attribute that is established when
you create the file and cannot be changed.
Table 16 File Organization
DescriptionOrganization
A sequential file is organized so that each record except the first has a unique
predecessor record and each record except the last has a unique successor
Sequential
record. These relationships are established by the order in which the records
are written and cannot be subsequently changed. The only alterations a program
can make to an existing sequential file are record replacement (updating an
existing record) and record creation (appending a new record following the
last existing record).
Under the NonStop operating system, COBOL sequential files are unstructured
files or entry-sequenced files.
A line sequential file (code 180) is a sequential file that is compatible with the
system text editor of the OSS environment; therefore, it can also be called an
Line Sequential
OSS ASCII text file. A line sequential file differs from a sequential file in that
each of its records ends with a line-feed character. For its other characteristics,
see Line Sequential Files (page 716) Line Sequential Files.
Under the NonStop operating system, COBOL line sequential files are line
sequential files.
A relative file is organized as a sequence of record areas, each capable of
holding a logical record. The successive record areas are uniquely identified
Relative
by successive integer values (called relative record numbers), beginning with
one for the first record area. A program can select any record area for an
Data Structures 81










