Start of change

COBOL/Java interoperability outside of the object-oriented (OO) COBOL framework

Enterprise COBOL supports a more comprehensive and flexible form of Java™ interoperability than that provided by the object-oriented (OO) COBOL framework.

The main goals of the stand-alone COBOL/Java interoperability feature are as follows:
  • Provide an easy way for Java applications to call existing COBOL programs without requiring substantial changes to the COBOL programs and without imposing substantial new build requirements on them. Instead, user programs will be called dynamically and can continue to reside in typical user program object libraries.
  • Provide an easy way to modify existing COBOL programs so that they can conveniently make calls to static Java methods using a standard CALL statement.
  • Provide comprehensive support for automatic conversion between a wide variety of popular Java data types and their corresponding COBOL types so that parameter passing and returned value handling require no special processing in user code. This substantially reduces the need for COBOL programmers to know anything about Java Native Interface (JNI) programming. By comparison, in the OO COBOL framework, even dealing with an incoming String object from Java requires knowledge of JNI to get, and possibly convert, the Java string data so that it can be moved into a data item that is defined with a PIC X, PIC N, or PIC U clause.

    COBOL data types that are automatically mapped to Java types are referred to as Java-compatible COBOL data types. For details, see Mapping between COBOL and Java types in the Enterprise COBOL for z/OS Language Reference.

  • Provide Java applications a way to easily access COBOL WORKING-STORAGE memory directly, for both read and write purposes.
  • Make it easy for AMODE 31 COBOL programs to interoperate with 64-bit Java applications.
To meet these objectives, the stand-alone Java interoperability feature of Enterprise COBOL consists of the following elements:
  • JAVA-CALLABLE directive that makes an existing COBOL program automatically callable by Java.
  • JAVA-SHAREABLE directive that identifies one or more 01/77-level WORKING-STORAGE data items that are to be made accessible to Java applications for both reading and writing.
  • An enhanced CALL statement that interprets literal CALL targets of the form: 'Java.java-class-name.java-static-method-name' as calls to a static Java method.

Related references
Example: COBPROD application - building and running
JAVA-CALLABLE (Enterprise COBOL for z/OS Language Reference)
JAVA-SHAREABLE (Enterprise COBOL for z/OS Language Reference)

End of change