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

Index-Name
If a data item is external and/or global and includes a table accessed with an index, that index
is also external and/or global (respectively); therefore, the scope of an index-name is identical to
that of the data-name that names the table whose index is named by that index-name, and the
scope rules for data-names apply. Index-names cannot be qualified.
Common Programs
A common program is one that includes the COMMON clause in its Identification Division. A
common program can be called by any program directly or indirectly contained in the program
that directly contains the common program (except for the called program itself and the programs
that it contains). In Example 4: Programs With Shared Data, if program Aaa includes the COMMON
clause, the programs Bbb, Ccc, and Ddd can call it.
Programs in the Same Run Unit
A program and the programs that it contains are always in the same run unit, but separate programs
(not contained in that program and not containing it) can also be in the same run unit.
Initial Programs
An initial program has an INITIAL clause in its Identification Division. An initial program’s program
state is initialized whenever the program is called. If program X is an initial program, whenever
a program calls X, the program state of X is the same as when X was first called in that run unit.
During the process of initializing an initial program:
The program’s internal data items are initialized (see Initializing Data Items (page 177)).
Files with internal file connectors associated with the program are not in the open mode.
The control mechanisms for all PERFORM and ALTER statements contained in the program are
set to their initial states.
The CANCEL and NOCANCEL directives, which determine whether a program is initialized the
first time it is called after having been canceled by a CANCEL statement, do not affect initial
programs. Initial programs are initialized every time they are called, whether or not they were
cancelled.
How Programs Share Resources
A program can share resources with programs that it contains (directly or indirectly) and programs
that are in the same run unit as it is.
The resources that a program can share with programs that it contains are:
record-names
data-names
condition-names
file-names
The program makes them accessible to the inner programs by declaring them to be global. This
enables the inner programs to use the associated data items and file connectors without declaring
them. (The opposite of global is local. Local names are only accessible to the program that declares
them.)
The resources that a program can share with programs in its run unit are:
data items
file connectors
Common Programs 51