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

Using HP COBOL in the OSS Environment
HP COBOL Manual for TNS/E Programs520347-003
19-4
Mixed-Language Programs
Mixed-Language Programs
In the OSS environment, you can write mixed-language programs.
Native HP COBOL programs can call programs written in native HP COBOL, native
HP C, native HP C++, or pTAL.
To produce a native HP COBOL program that contains native HP COBOL and native
HP C modules, follow these steps:
1. Using the c89 utility, compile the HP C modules, but do not link them.
2. Using the ecobol utility, compile the HP COBOL modules, specifying any
necessary linking or SQL-compiling flags.
For example, suppose that you want to produce a loadfile from the native HP COBOL
modules cobol1.cbl and cobol2.cbl and the native HP C modules c1.c and
c2.c.
First you use the c89 utility to compile the HP C modules without linking them:
c89 -c -o cprog.o c1.c c2.c
The resulting object file is cprog.o.
Then you use the ecobol utility to do this:
Compile the HP COBOL modules
Link the ecobol compiler output, the object file cprog.o, and the native HP C
library.
Produce the loadfile myprog:
ecobol -o myprog cprog.o cobol1.cbl cobol2.cbl
The ecobol utility automatically links the HP C DLLs to myprog.
Changing Default Pathnames and Disk Volume
The “Default” column of Table 19-1 shows the default pathnames of the programs that
the ecobol commands call and the default disk volume on which they create
temporary files.
To change one or more of these defaults before executing the ecobol command, use
the export command.
To execute an ecobol command with a specified set of environment variables, use the
OSS env function with the environment variables that Table 19-1 lists and explains.
For the syntax of the env function, see the env(1) command reference page either
online or in the Open System Services System Calls Reference Manual.
The effect of the export command lasts until you explicitly change it. The effect of the
env function applies only to the ecobol command with which you use it.