COBOL Manual for TNS/E Programs (H06.03+)

Source Program Organization and Format
HP COBOL Manual for TNS/E Programs520347-003
2-14
External and Internal Objects
Some names are always global; other names are always local; and some names are
either global or local, depending on specifications in the program that declares the
names:
In some circumstances, a data description, file description, or record description entry
cannot specify the GLOBAL clause (see GLOBAL Clause).
If a data-name, file-name, or condition-name declared in a data description entry is not
global, the name is local.
Global names are inherited by contained programs. Suppose program OUTER
declares a name X to be global and contains program INNER, which contains program
INNERMOST. As long as program INNER does not define the name X explicitly, a
reference to X in INNER refers to the X defined in OUTER. Also, as long as program
INNERMOST does not define the name X and program INNER does not define X as a
global name, a reference to X in INNERMOST refers to the X defined in OUTER.
Global names, as well as local names, can be associated with 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.
Name It is global if a GLOBAL clause is in …
Record-name its record description entry
or
the file description entry for the file-name associated with its record
description entry (if the record-name is in the File Section)
Data-name its record description entry
Condition-name an entry to which its data description entry is subordinate (that is, if a
data-name is declared global, all condition-names subordinate to it are
automatically global)
File-name its file description entry