COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-61
ENTER
Usage Considerations:
language
If you call a routine with a particular value of language (or with language
omitted), you must use the same value of language each time you call that
routine in the same compilation unit.
file-mnemonic
If you specify file-mnemonic but the compiler does not find the called routine in
the associated object file, the compiler reports an error. For information on
resolving external references, see Finding the Entered Program.
USING Phrase
The number and type of the parameters in the USING phrase must be compatible
with the expectations of the called routine. The called routine might interpret the
parameters slightly differently than the calling program does (see Appendix B, Data
Type Correspondence).
GIVING Phrase
When calling a function (a routine that returns a value), include a GIVING phrase in
the ENTER statement. When control returns to the COBOL program, the value that
the function returns is assigned to return-value.
Scaling of the function’s value (if needed) is performed before the value is
assigned to return-value. If the function’s value is larger than the maximum
value allowed for a COBOL identifier, the COBOL program terminates with an
arithmetic overflow condition during the conversion process. The assignment
operation follows MOVE conventions (see MOVE TO).
Passing Parameters by Value
When a formal parameter (in the called routine) is to be passed by value, the
actual parameter (in the ENTER statement) must be a numeric literal, a numeric
data item, a special register, an arithmetic expression, or the word OMITTED. If the
parameter is not OMITTED, it is evaluated, scaled, and converted to the storage
size and type of the formal parameter. The resulting value is passed to the called
routine. This conversion might cause an arithmetic overflow.
Passing Parameters by Reference
When a formal parameter (in the called routine) is to be passed by reference, the
actual parameter (in the ENTER statement) must be a data item or, in some
routines supplied by HP, a file name.
If the actual parameter is a data item, the compiler generates code to pass the
address of the data item’s storage space to the called routine. The calling program
and the called routine must interpret the value of the data item the same way.
If the actual parameter is a file name, the compiler generates code to pass the
address of the COBOL file control block to the called routine.