COBOL Manual for TNS and TNS/R Programs
Calling Other Programs and Routines
HP COBOL Manual for TNS and TNS/R Programs—522555-006
23-31
Passing Parameters to Non-COBOL Routines
Pascal
By default, Pascal routines use 16-bit addressing for parameters and pointer allocation
(the “small-memory model”). You can specify 32-bit addressing by using the Pascal
compiler directive XMEM (the “large memory model”), but whatever the addressing
mode is, it applies to the entire Pascal module. All Pascal modules that are bound into
one object file must use the same addressing mode.
In both the non-CRE environment and the CRE:
•
The default addressing mode is extended (32-bit) in HP COBOL but 16-bit in
Pascal. You can specify standard (16-bit) addressing in HP COBOL with an
ACCESS MODE clause, and you can obtain 32-bit addressing (among other
things) in Pascal with an XMEM directive. Verify that each actual HP COBOL
parameter uses the same addressing mode as its corresponding formal Pascal
parameter.
•
In HP Pascal for NonStop systems (“HP Pascal”), if you declare a routine itself to
be EXTENSIBLE, then in its routine header, you can explicitly declare each formal
parameter to be optional (meaning that the calling program need not supply an
actual parameter for it). If an HP COBOL program calls an extensible Pascal
routine, the HP COBOL program must use the keyword OMITTED in place of each
omitted optional parameter, except in the case of trailing omitted optional
parameters. For example, if the Pascal routine header is
MY_PROC ( R : INTEGER; OPTIONAL O1, O2 : INTEGER);
an HP COBOL program can call the Pascal routine with any of these statements:
ENTER PASCAL "MY_PROC" USING A
ENTER PASCAL "MY_PROC" USING A B
ENTER PASCAL "MY_PROC" USING A B C
ENTER PASCAL "MY_PROC" USING A OMITTED C
Note. This topic applies only to TNS HP COBOL programs. Native HP COBOL programs
cannot call Pascal routines. If you want your native HP COBOL program to call a FORTRAN
routine, convert the Pascal routine to native HP C, native HP C++, or pTAL.