COBOL Manual for TNS and TNS/R Programs
Source Program Organization and Format
HP COBOL Manual for TNS and TNS/R Programs—522555-006
2-17
External and Internal Objects
External and Internal Objects
An external object is stored in an area that is associated with the run unit rather than
with any particular program within the run unit.
An internal object is stored in an area that is associated only with the program that
describes the object.
An external object can be referenced by any program in the run unit that describes the
object. All such descriptions must be identical, or the results of the references are
unpredictable. References to an external object from different programs are always to
the same object. In a run unit, there is only one representation of an external object.
External and internal objects can have either global or local names.
Topics:
•
Data Records in Working and Extended-Storage
•
File Connectors and Their Records
•
Linkage Section Records
Data Records in Working and Extended-Storage
To give a data record described in the Working-Storage or Extended-Storage Section
the external attribute, include the keyword EXTERNAL in its data description entry.
Only record data description entries can include the EXTERNAL clause. Any data item
described by a data description entry subordinate to an entry describing an external
record also inherits the external attribute.
If a record or data item does not have the external attribute, it is part of the internal
data of the program that describes it.
File Connectors and Their Records
To give a file connector the external attribute, include the keyword EXTERNAL in its file
description entry. When a file connector has the external attribute, the records and the
data items of the file inherit the external attribute.
If a file connector does not have the external attribute, it is internal to the program that
describes the associated file-name.
The data records described subordinately to either of these file description entries are
internal to the program that describes the file-name unless the data records
themselves are declared to be external:
•
A file description entry that does not contain the EXTERNAL clause
•
A sort-merge file description entry
Any data items described subordinate to the data description entries for such records
are also internal to the program that describes the file-name.