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

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-27
CALL
Parameter Validation
The ECOBOL compiler reports errors if the number of actual parameters (in the
CALL statement) differs from the number of formal parameters (in the Procedure
Division heading).
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.
°
Each program opens the file as an internal file with a separate file connector.
°
The file name has the GLOBAL attribute.
°
The file is declared in any program and is given the EXTERNAL attribute. Then
the file belongs to the run unit, and any program in the run unit that declares
the same file with the EXTERNAL attribute can share in its manipulation.
Difference Between X/Open CALL Statement and ENTER Statement
The X/Open CALL statement reports an error if the types of the actual and formal
parameters do not match; the ENTER statement attempts to convert the actual
parameters into the types of the formal parameters.