C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Mixed-Language Programming for TNS Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
7-32
Interfacing to TNS COBOL
To compile the programs in the Guardian environment:
1. Compile the COBOL function named testcob using the TNS COBOL compiler:
cobol85 /in testcob / testcobo
2. Compile the C program named testc using the TNS C compiler:
c / in testc/ testco
3. Link the object files using Binder and the file BINDIN:
bind / in bindin, out listfile /
4. To run the executable named testexe:
run testexe
I AM DOING COBOL NOW
D-STRING = Displayed in COBOL.
D-LARGE = 0000040000
D-SHORT = 00100
D-RESULT = 000000400
LEAVING COBOL PROGRAM NOW
I'm Back in C and program is ending
Example 7-3. Include File (Prototype Function)
/* COBINCLH */
/* Following is the new way to declare extern COBOL calls */
void XCOBFUNC (char *, short *, long *);
#pragma FUNCTION XCOBFUNC (cobol)
Example 7-4. Binder File
select check parameter strong
add * from testco
add * from testcobo
select search $system.system.cwide
set heap 64
build testexe