Tutorial :Utilizing Java API from a Cobol program



Question:

We have some COBOL programs running on our mainframe and we need one of those to communicate with our back end vault through a Java API. Is there any way a Cobol program can invoke the Java program?

Would it be possible to use a Web Service from Cobol? How would I integrate a Cobol program with anything else?


Solution:1

Don't know if this is where you found the info, but this list of COBOL White Papers includes a section on COBOL/Java integration, including some specific to Enterprise COBOL.


Solution:2

Found this:

A COBOL program can interoperate with JAVA.

To achieve inter-language interoperability with Javaâ„¢, you must follow certain rules and guidelines for: Using services in the Java Native Interface (JNI) Coding data types Compiling your COBOL programs You can invoke methods that are written in Java from COBOL programs, and you can invoke methods that are written in COBOL from Java programs. For basic Java object capabilities, you can use COBOL object-oriented language. For additional Java capabilities, you can call JNI services.

Because Java programs might be multi-threaded and use asynchronous signals, compile your COBOL programs with the THREAD option.

Also, we are using Cobol Enterprise, which has support for web services. The integration shall then be done using the WS functionality found in Cobol Enterprise.


Solution:3

I'm guessing that any Java integration would be a vendor extension. What compiler are you using?

If your Cobol program is running as a batch job, you might be able to split it into two batch jobs, one that writes all of the queries for Java land into a file, and one that uses the answers from Java land. Run a Java program between them that reads the query file and writes out an answers file.


Solution:4

This is a shot in the dark but Dr Dobbs has a recent article on Cobol and Java (see here). On page 3, they mention running Cobol on the JVM with some vendor info. That is quite a departure from your question but might lead to some new resources on the web.


Solution:5

Microfocus does allow COBOL and Java to interact but to do what you require you will need to use a Microfocus derivative called OO COBOL.


Solution:6

I don't code in COBOL, but at my work, we have an MVS system where the programmers have output XML/Web services from COBOL.


Solution:7

For the AS/400 there is the IBM Java toolbox. Check the java programming section in the infocenter.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »