Use the cob2 command to link OO COBOL applications.
To prepare an OO COBOL client program for execution, link the object file with the following two DLL side files to create an executable module:
To prepare a COBOL class definition for execution:
For a COBOL source file Classname.cbl that contains the class definition for Classname, you would use the following commands to compile and link the components of the application:
| Command | Input | Output |
|---|---|---|
| cob2 -c -qdll,thread Classname.cbl | Classname.cbl | Classname.o, Classname.java |
| cob2 -bdll -o libClassname.so Classname.o /usr/lpp/java/IBM/J1.3/bin/classic/libjvm.x /usr/lpp/cobol/lib/igzcjava.x | Classname.o | libClassname.so |
| javac Classname.java | Classname.java | Classname.class |
After you issue the cob2 and javac commands successfully, you have the executable components for the program: the executable DLL module libClassname.so and the class file Classname.class. All files from these commands are generated in the current working directory.
Example: compiling and linking a COBOL class definition under z/OS UNIX
related references
cob2 syntax and options