Overview of Calling Java from OO COBOL

Restriction: This applies to native code only.

Micro Focus Java support enables you to send messages to Java objects from OO COBOL programs and classes.

Java is supported through a Java domain in OO COBOL. The Java domain enables you to declare Java classes inside a COBOL program. You can then send messages to the Java classes. The Java domain support works by creating a COBOL proxy object for each Java object, as shown in the figure below. The class itself that you declare is a proxy for the static methods of the Java class.

The Java Proxy

Your program needs to have a Repository paragraph, and needs to use the INVOKE verb each time you want to call a Java method, although it does not have to be written as an OO COBOL class.

The COBOL run-time system converts parameters sent with messages from COBOL data types to Java data types. If a method returns a parameter, it is converted from a Java data type to a COBOL data type.

Using the techniques described in this chapter, you can call any Java API, such as JDBC, Sockets and Swing.

You need to have at least a basic knowledge of the Java language to be able to use this technology effectively. The Java Web site is a good starting place.

You can also call COBOL programs from Java without using the OO COBOL Java domain.