COBOL Manual for TNS and TNS/R Programs

Data Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
7-42
Index-Names
Index-Names
A Procedure Division reference to a Linkage Section data item in the called program
refers to a location in the calling program; however, this convention does not extend to
index-names. The index-name of a table in the calling program and the index-name of
a table in the called program always refer to separate indexes. This remains true even
when the names of the indexes are the same in the calling program and the Linkage
Section of the called program. An index-name’s value can be passed if it is saved in a
separate item and then passed. (See the example under CALL.)
Absent Linkage Section
If there is no Linkage Section in the called program, it looks like a main program to the
compiler. If you compile a main program and a subprogram with no parameters in the
same compilation session, you must include either a MAIN directive or an empty
Linkage Section to tell the compiler which program is the main one (see Main
Programs). If you do neither, the compiler reports that it found two main programs.
Because the compiler interprets subprograms that have no parameters as main
programs, if you want to compile a collection of such subprograms, you need to direct
the compiler not to attempt to give any of them the main attribute. To do this, use a
MAIN directive specifying a program-name that does not correspond to the name of
any program in the compilation.