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

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-58
ENTER
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.
Addressing Parameters
All instructions use 32-bit addressing. Many COBOL data items are byte-
addressed. Some data items in other languages are 2-byte-addressed. When you
pass a byte-addressed parameter to a routine that expects a 2-byte-addressed
parameter, the data item must be aligned on a 2-byte boundary; otherwise,
problems can arise, because the called routine is expecting an aligned parameter.
The compiler does not issue a warning in this case.
°
pTAL
In pTAL modules, each data item declaration (including parameter
declarations) specifies either 1-byte or 2-byte addressing. All declarations use
32-bit addressing.
°
C and C++
In HP C and HP C++ modules, all data item declarations (including parameter
declarations) use 32-bit addressing.
Restrictions on Calling HP C and HP C++ Functions
An HP COBOL program cannot call an HP C or HP C++ function for which any of
these conditions are true:
°
The function name includes lowercase letters.
°
The function prototype specifies a variable number of parameters.
°
The function returns a structured value.