COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-28
CALL
The COBOL85 compiler determines the access mode of the parameters in one of
these ways:
°
The called program is found in an existing object file (either the object file
named by mnemonic-name or an object file named in the SEARCH directive).
The required parameter types are defined by the program in the existing object
file.
°
The called program has been compiled earlier in the current compilation. The
required parameter types are defined by the Linkage Section of the called
program.
°
The called program has not yet been found during the current compilation, or is
specified by identifier rather than by an explicit program-name. The
compiler assumes that all parameters are passed with extended addresses
(the default for the Linkage Section of the called program). If the called
program declares any matching parameters with ACCESS MODE
STANDARD, the program executes incorrectly. If identifier is not
specified, a subsequent attempt to bind the missing program to the run unit can
cause a Binder error.
The HP COBOL compilers do not report errors under these conditions:
°
The type (alphanumeric, numeric, and so on) of an actual parameter differs
from that of its corresponding formal parameter.
°
The size of an actual parameter differs from that of its corresponding formal
parameter.
•
Passing Index Values
You cannot pass an index-name (defined by the INDEXED phrase of an OCCURS
clause) as a parameter because it is not a level 01, level 77, or elementary data
item. You can pass an index value in an index data item (defined by a USAGE
INDEX clause) as a parameter, but there is no correspondence between the index-
name used with the table in the calling program and the index-name used with the
table in the called program. Index-names in the called and calling program always
refer to separate data areas.
•
Recursion
Although called programs can contain CALL statements, a called program cannot
call itself explicitly or implicitly.
•
Calling and Called Program Using the Same File
A called program does not inherit access to an internal file opened by its caller. A
calling program and a called program can operate on records of the same file in
these ways:
°
One of the programs does all the reading and writing and passes the data
items as parameters to the other.