Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


Calling a COBOL method from an IMS Java application

You can use the object-oriented language support in Enterprise COBOL to write COBOL methods that an IMS Java program can call.

When you define a COBOL class and compile it with the Enterprise COBOL compiler, the compiler generates a Java class definition with native methods, and the object code that implements those native methods. You can then create an instance and invoke the methods of this class from an IMS Java program that runs in an IMS Java dependent region, just as you would use any other class.

For example, you can define a COBOL class that uses the appropriate DL/I calls to access an IMS database. To make the implementation of this class available to an IMS Java program, do the following steps:

  1. Compile the COBOL class with the Enterprise COBOL compiler to generate a Java source file (.java) that contains the class definition and an object module (.o) that contains the implementation of the native methods.
  2. Compile the generated Java source file with the Java compiler to create a class file (.class).
  3. Link the object code into a dynamic link library (DLL) in the HFS (.so). The HFS directory that contains the COBOL DLLs must be listed in the LIBPATH, as specified in the IMS.PROCLIB member that is indicated by the ENVIRON= parameter of the IMS region procedure.
  4. Update the sharable application class path in the master JVM options member (ibm.jvm.sharable.application.class.path in the IMS.PROCLIB member that is specified by the JVMOPMAS= parameter of the IMS region procedure) to enable the JVM to access the Java class file.

When you write the initial routine of a mixed-language application in Java, you must implement a class that is derived from the IMS Java IMSApplication class.

A Java program cannot call procedural COBOL programs directly. To reuse existing COBOL IMS code, use one of the following techniques:


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)