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

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-26
CALL
°
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.
°
Use the SEARCH directive to add the program to the primary search list.
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.
Storage Allocation
For programs with the INITIAL attribute, HP COBOL uses dynamic storage
allocation, allocating space for data items in the Working-Storage Section each
time the program is called and releasing it each time the program is exited. This
can cause stack overflow, which can cause the run unit to terminate abnormally.
For programs without the INITIAL attribute, HP COBOL allocates space at the start
of execution of the run unit for all program data except internal data, which it
allocates when the program is called. It is unlikely that allocating space for internal
data (usually a small amount) will cause stack overflow.
Passing Parameters
Parameters passed by the USING phrase are data items from a calling program
that the called program can reference.
Correspondence of Formal and Actual Parameters
The formal parameters in the USING phrase of the Procedure Division header and
the actual parameters in the USING phrase of the CALL statement correspond by
position, not by name.
Declaration Locations and Access Modes of Formal and Actual Parameters
You must declare formal parameters in the Linkage Section. Every parameter has
a 32-bit address.If you specify STANDARD access mode, the ECOBOL compiler
ignores it and issues a warning.