You can call procedural COBOL programs from Java or from EJBs written in any language, not necessarily COBOL. There are a number of ways of doing this, which are summarized in the chapter Using Java and COBOL Together chapter.

This chapter describes how to use the support provided in the com.microfocus.cobol.RuntimeSystem class and the CobolBean class, which is actually an extension to the RuntimeSystem class and uses RuntimeSystem.cobcall*() methods. Use this technique if you do not want to use OO COBOL and do not want to use Enterprise Server.

Access to Java objects is available either through the Java Native Interface (JNI), or by use of the OO COBOL Java domain.

The Java support in the com.microfocus.cobol.RuntimeSystem class provides functions which enable you to load, call and cancel COBOL programs. It also enables you to pass parameters to a COBOL program using a Java array. The functions in com.microfocus.cobol.RuntimeSystem class unpack the array and pass the data to your COBOL program in a form it can use. The figure below shows a Java program calling a COBOL program and passing it two parameters.

Figure 1. Calling COBOL from Java
Calling COBOL from Java

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

See the section Setting Up the Environment for Java and COBOL in the chapter Using Java and COBOL Together for instructions on how to set up the environments.