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.
- 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
- 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 N, or
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-STORAGEmemory directly, for both read and write purposes.
- Make it easy for AMODE 31 COBOL programs to interoperate with 64-bit Java applications.
JAVA-CALLABLEdirective that makes an existing COBOL program automatically callable by Java.
JAVA-SHAREABLEdirective that identifies one or more 01/77-level
WORKING-STORAGEdata items that are to be made accessible to Java applications for both reading and writing.
- An enhanced
CALLstatement that interprets literal
CALLtargets of the form: 'Java.java-class-name.java-static-method-name' as calls to a static Java method.
Example: COBPROD application - building and running
JAVA-CALLABLE (Enterprise COBOL for z/OS Language Reference)
JAVA-SHAREABLE (Enterprise COBOL for z/OS Language Reference)