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-16
Restrictions on Calling Non-COBOL Routines
Restrictions on Calling Non-COBOL Routines
TNS HP COBOL programs can call only TNS programs, and native HP COBOL
programs can call only native routines. This means that a TNS HP COBOL program
can call routines written in TNS HP C, FORTRAN, Pascal, and TAL, and that a native
HP COBOL program can call routines written in native HP C, native HP C++, and
pTAL.
These topics explain the restrictions on calling non-COBOL routines from HP COBOL.
For information about passing HP COBOL parameters to such routines, see Passing
Parameters to Non-COBOL Routines.
Topics:
•
HP C Routines
•
HP C++ Function Name Consideration
•
FORTRAN Routines
•
Pascal Routines
•
TAL Routines
HP C Routines
An HP COBOL program running in the non-CRE environment cannot call any HP C
function that directly or indirectly allocates or deallocates memory or performs HP C
input-output operations. Similarly, an HP COBOL program must not call an HP C
function that directly or indirectly accesses the HP C function getenv.
An HP COBOL program running in the CRE indirectly calls HP C functions that allocate
and deallocate memory and perform HP C input-output operations. Do not directly call
the HP C function getenv from an HP COBOL program.
If a program has a COBOL MAIN program, and calls HP C or HP C++ functions that
perform HP C or HP C++ I/O operations on the standard files stdin, stdout, or
stderr, the HP C library function fopen_std_file must be called before any such
operations take place. You need fopen_std_file (0,x ) for input,
fopen_std_file (1,x ) for output, and fopen_std_file (2,x ) for the stderr.
This function must be called from an HP C or HP C++ routine. Also, the HP C program
must be compiled “with extensions” if you are going to call this function. See the
Guardian Native C Library Calls Reference Manual for more information on the
fopen_std_file function.
In both the non-CRE environment and the CRE, an HP COBOL program cannot call an
HP C function that has these characteristics:
•
Has lowercase letters in its name, if the HP C function is called by ENTER (the
compiler upshifts them). This restriction does not apply to HP C functions called by
CALL.
•
Has a variable parameter list.