COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-26
CALL
Binding or Linking a Program Called With a CALL identifier Statement
Binding or linking a program called with a CALL identifier statement into a run
unit is not automatic. Verify that all such programs are bound or linked into the run
unit by doing one of:
°
Compile all the program units in a single source file.
°
For a TNS program, use the Binder object-file builder to bind the required
program units into the run unit (see the Binder Manual). For a native program,
use the nld or ld utility to link them into the run unit (see the nld Manual or the
ld Manual).
°
Have each required program bound or linked into the run unit by referring to
the program explicitly in the source program with a dummy CALL statement
and then calling the program by an identifier.
°
For a TNS program, bind the program into the user library.
°
Use the SEARCH directive to add the program to the primary search list.
How the BIND Process Finds the Object File (TNS Programs Only)
If file-mnemonic is present but the BIND process does not find the called
program in the associated object file, BIND reports an error.
If file-mnemonic is absent but a search list was specified, the BIND process
searches for the object file as explained in How the Compiler Validates and
Resolves References.
Initial State of Called Programs
A program that has the INITIAL attribute is in its initial state every time it is called.
Programs directly or indirectly contained within a program that has the INITIAL
attribute also have the INITIAL attribute.
A program that does not have the INITIAL attribute is in its initial state the first time
it is called, but each successive time it is called, it is usually in the state in which its
previous execution left it. This state includes the final value of each internal data
item (except those described in the Linkage Section), the final status of each
internal file connector, and the final status of each GO TO statement whose
destination procedure was specified by an ALTER statement.
A program that does not have the INITIAL attribute is not in the state in which its
previous execution left it if its calling program cancelled it with a CANCEL
statement. In this case, the called program is in its initial state the next time it is
called. All PERFORM statements in the program are restored to their initial states.
All files are closed.