JVM COBOL support

Java Virtual Machine

You can edit, debug, and compile COBOL applications to JVM byte code (.class files) so that they can be run on a Java Virtual Machine. The following limitations and restrictions apply:

  • JVM COBOL is not supported in Mainframe Subsystem applications.
  • Currently, JVM COBOL is only supported on System z running Linux 390 when the JIT compiler is restricted to use only the cold level optimisations.

    This can be done by specifying 'cobjrun -Xjit:optLevel=cold ProgramName' (or 'java -Xjit:optLevel=cold ProgramName') to launch the program. For more information, see the topic Selectively disabling the JIT in the Java SDK documentation available on IBM's Web site.

  • In JVM_LOAD_NATIVE, the myLibrary parameter must be passed as a literal; it cannot be declared in a COBOL storage section.
  • You cannot use the COBCONFIG or COBCONFIG_ environment variables. You must use COBCONFIGJVM instead.
  • The format of a JVM tunables file must be that of a standard Java properties file and not the format used by the native runtime.
  • XML PARSE is not supported in JVM COBOL code. XML GENERATE is supported.
  • You cannot use generics in your JVM COBOL code.
  • COBOL class package and the directory structure is enforced. You might get errors finding source code.

    For example:

    If a COBOLClass1.cbl is within a package com.microfocus.core then it should be in the Project/src/com/microfocus/core/COBOLClass1.cbl directory. In the case the com.microfocus.core package is mapped to com/microfocus/core directory.

  • You cannot pass a JVM procedure-pointer to a native COBOL application.
  • There is a known issue with IBM’s JVM support for the Java™ Attach API which causes the API to leak semaphores under certain conditions. If you are running IBM’s JVM on AIX and Redhat or SUSE Linux on z390, this can cause your machine to run out of semaphore space resulting in the machine running slower or causing intermittent failures.

    To determine whether you are experiencing this issue, type the following at the command line to check the number of semaphores that start with the 0xa1 prefix:

    "ipcs -s -r | grep 0xa1 | wc –l"

    If this number is very high and keeps growing you need to follow the cleanup procedure described in the "IBM Developer Kit and Runtime Environment Diagnostics Guide", "Chapter 19. Attach API problem determination", ftp://public.dhe.ibm.com/software/dw/jdk/diagnosis/diag50.pdf

    You can disable the Java™ Attach APIs to avoid the issue. Note, however, that when Attach API is disabled, it will not be possible for other Java application to attach to your application and features such as jtop, jstat, jconsole, JMX agents, JVMTI agents will cease to function.

    The Attach API is enabled by default for Java 6 SR6 and later. To disable the feature you need to set the IBM JVM property com.ibm.tools.attach.enable to "no".

    You can use this property with any Java trigger, or with IBM’s environment variable IBM_JAVA_OPTIONS which allows you to pass extra arguments to the JVM without changing any command lines.

    You can set the variable as follows:

    export IBM_JAVA_OPTIONS=-Dcom.ibm.tools.attach.enable=no
  • A combination of using continuation lines and a source-format of variable has been known to produce screen corruption and sometimes crash the JVM. A workaround is to compile your application with the source-format"fixed" directive, or if that is not possible, set and then unset the directive immediately before and after the code containing the continuation lines.
  • COBOL JVM projects require Java 7 or later. Trying to build a COBOL JVM project that targets a version of Java earlier than version 7 while having it installed in Eclipse results in a COBOL syntax error COBCH1561S ("JVM support not found: are you using a supported version of the JRE?"). You can use the Quick Fix command to resolve the problem and link to a supported version of Java:
    1. In Problems view, right-click the row containing the error.
    2. Click Quick Fix. Alternatively, you can press Ctrl+1. This opens the Quick Fix dialog box with a suggested fix for the problem.
    3. Select the fix that replaces the old JRE with a supported JRE version.
    4. Click Finish.
    If a supported JRE is installed on your machine, you receive a message that the JRE has been successfully replaced. If no supported JRE build path is available on your machine, then you need to add it, see Compiling JVM COBOL for more details.

Application Servers

You can edit, debug, and compile COBOL applications to run on a variety of application servers. The following are not supported:

  • COBOL file handling (including ACUCOBOL-GT file handling and Fileshare)
  • Threading syntax, such as START and WAIT, and the CBL_THREAD library routines
  • The PC_PRINTER library routines
  • CALLing native COBOL library routines or OS-native APIs
  • The STATIC keyword for class members
  • Enhanced ACCEPT/DISPLAY statements
  • Deploying the SQL runtime in a shared model while deploying the COBOL runtime in a per-bean model when using a class that implements the EJB specification to run your JVM COBOL code.