COBOL Manual for TNS and TNS/R Programs
Data Fundamentals
HP COBOL Manual for TNS and TNS/R Programs—522555-006
4-11
Files
File Connector
A COBOL program makes reference to files indirectly. It does not refer to a file by the
file’s Guardian file name. Instead, it uses an ASSIGN clause in a file-control entry in
the Input-Output Section of the Environment Division (possibly overridden at execution
time by command interpreter commands) to associate the Guardian file name with a
file connector, which is referred to throughout the remainder of the COBOL program
through a COBOL file name.
The file connector is an entity that exists at execution time and contains information
about the file, such as its open mode, position, and so on. A file connector can be
internal or external to a given COBOL program. Unless a file connector is explicitly
described as external, it is internal.
An internal file connector is associated with and only accessible to the specific program
that describes it or to programs contained within that program. An external file
connector is associated with the run unit and accessible to every program in the run
unit that describes the file connector.
The execution of an OPEN statement associates a physical file with a file connector.
HP COBOL permits the simultaneous association of one physical file with more than
one file connector in a run unit in certain cases.
The execution of a CLOSE statement dissociates a physical file from a file connector.
In this manual, “file” is often used as an abbreviation for “file connector” and “file name”
as an abbreviation for “file referenced by file name.” The context determines the
meaning in these cases.
File Position Indicator
The file position indicator is a conceptual component of a file connector, and its setting
is a dynamic attribute of the connector. During sequential record retrieval operations,
the setting of the file position indicator determines precisely which record is the next
one to be accessed.
Normally, the setting reflects:
•
A record number for a sequential or line sequential file
•
A relative record number for a relative file
•
A prime record key value for an indexed or queue file
•
An alternate record key value for a file with any organization
Sometimes its setting indicates that:
•
The at-end condition exists (due to a prior unsuccessful execution of a READ
statement for the file).
•
No valid next record has been established.
•
An optional file is not present.