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

HP C Routines
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 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.
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.
Returns a structured value.
Specifies a formal parameter whose type has no corresponding HP COBOL type (to see which
HP C types have corresponding HP COBOL types, see Appendix B: Data Type Correspondence
(page 1234).
A TNS/E HP COBOL program and a TNS/E HP C program can share data under these conditions:
Level-01 HP COBOL data items are described with the EXTERNAL clause.
HP C data names that the HP COBOL program references have no lowercase letters or
underscores.
If the HP COBOL and HP C programs are sharing strings, the strings end in the zero byte that
HP C expects.
In Example 251, the HP COBOL and HP C programs share the data item MYVAR.
Calling Non-COBOL Routines 803