Chapter 6. Java Native Interface (JNI) 107
A COBOL source file that contains a class definition must not contain any other
class or program definitions.
When you compile a COBOL class definition, two output files are generated:
The object file (.o) for the class definition.
A Java source program (.java) that contains a class definition that
corresponds to the COBOL class definition. Do
not edit this generated Java
class definition in any way. If you change the COBOL class definition, you
must regenerate both the object file and the Java class definition by
recompiling the updated COBOL class definition.
If a COBOL client program or class definition includes the JNI.cpy file by using a
COPY statement, specify the include subdirectory of the COBOL install directory
(typically /usr/lpp/cobol/include) in the search order for copybooks. You can do
this by using the -I option of the cob2 command, or by setting the SYSLIB
Preparing object-oriented applications under UNIX
Use the cob2 command to link object-oriented COBOL applications.
To prepare an object-oriented COBOL client program for execution, link the
object file with the following DLL side files to create an executable module:
libjvm.x, which is provided with your IBM Java 2 Software Development Kit.
igzcjava.x, which is provided in the lib subdirectory of the COBOL directory in
the HFS. The typical complete path is /usr/lpp/cobol/lib/igzcjava.x. This DLL
side file is also available as member IGZCJAVA in the SCEELIB PDS (part of
To prepare a COBOL class definition for execution, follow these steps
1. Link the object file using the DLL side files to create an executable DLL
You must name the resulting DLL module to libClassname.so, where
Classname is the external class-name. If the class is part of a package and
thus there are periods (.) in the external class-name, you must change the
periods to underscores (_) in the DLL module name.
For example, if class Account is part of the com.acme package, the external
class name (as defined in the REPOSITORY paragraph entry for the class)
must be com.acme.Account, and the DLL module for the class must be
2. Compile the generated Java source with the Java compiler to create a class