Native COBOL Compared to JVM COBOL

You can use Enterprise Developer for Eclipse to create both native and JVM COBOL applications. Native COBOL applications compile as native COBOL code that runs in Enterprise Server. JVM COBOL applications compile for JVM and can interoperate with other JVM applications regardless of the programming language in which they are written.

Procedural COBOL

Procedural COBOL is regular COBOL without the syntax features that take advantage of the JVM features. Procedural COBOL is still actively supported today and is being enhanced. Since the days of Net Express, Server Express, and Mainframe Express, it now supports inline local declarations (as in DECLARE). It also supports new syntax such as XML PARSE, JSON GENERATE, UTF-8, and more.

You can compile it to native or (in most cases) JVM COBOL. The core COBOL syntax is supported in JVM COBOL. However, there are some features that are not supported (for example Panels V2, Dialog System and ACUCOBOL-GT). This means that you can take most existing COBOL applications and recompile to create JVM COBOL applications.

JVM COBOL

JVM COBOL is COBOL with extensions to support the JVM. It offers OO syntax support and syntax to allow access to the available class libraries.

When you compile JVM COBOL, the compiler generates javabyte code: .class or .jar for JVM that runs on the Java Virtual Machine.

Native COBOL compared with JVM COBOL

Native COBOL and JVM COBOL differ in how they compile and how the run-time management services, such as security, threading and memory management are provided.

JVM COBOL for JVM compiles to Java bytecode, and native COBOL compiles to machine code. Both JVM COBOL and native COBOL can run on any supported platform when compiled.

For JVM code, the management services are provided by JVM. For native COBOL, the management services are available in the operating system, and your code has to call the appropriate services depending on the operating system. The management services enable seamless interoperation of COBOL programs with programs in other JVM languages.

Building native and JVM COBOL applications

In the IDE you can develop, compile and debug your applications, for both native and JVM COBOL.

When using Micro Focus Enterprise Developer UNIX Components in standalone scenarios, you use the command line to compile your native or JVM COBOL.

You can write new COBOL code or you can recompile existing COBOL as JVM COBOL or native code, potentially without any code changes.

You can deploy and further debug the native application under the run-time system provided by Enterprise Server. JVM COBOL applications are deployed to the platform running the JVM.

JVM COBOL and Native COBOL

You can compile your COBOL program (written in either native or JVM COBOL) to JVM COBOL code using the JVMGEN compiler directive. From within the IDE this happens automatically if you are using a JVM COBOL project.

The compiler has now created an intermediate language (JVM byte code .class/.jar).

COBOL and all other JVM languages (for example Java, JRuby and Jyphon) compile to this format, which makes mixed language applications easy to write.

You can also create native code applications. In Eclipse, the default COBOL project compiles to native code.

The compiler generates .exe/.dlls as the result of a native compilation.

The native COBOL application has to call the appropriate management services available for the operating system, whereas a managed application can take advantage of the management services provided by the run time such as exception handling, garbage collection, and thread management.

Developing Native COBOL and JVM COBOL Applications

You use the IDE to develop, compile and debug both native and JVM COBOL applications. You can write new COBOL code or you can recompile existing COBOL applications to native or JVM COBOL code, potentially without any code changes.

You can deploy and further debug the application under the run-time system provided by Enterprise Server.

JVM COBOL applications are deployed to a Java Virtual Machine for execution.

Run Time

Native COBOL:

You can deploy and further debug the native application under the run-time system provided by Enterprise Server. The management services are provided by the COBOL Run-Time System via CBL_APIs.

JVM COBOL:

The JVM byte code (.class/.jar files) can be deployed to a Java Virtual Machine for execution.

The JVM's just-in-time (JIT) compiler compiles the byte code into code native to the operating system. The JVM provides additional services including memory management, exception handling, garbage collection and thread management.

Native OO COBOL and JVM COBOL considerations

Certain technologies supported in native OO COBOL are not supported in JVM. In such scenarios, you might need to continue using native OO COBOL code - for example:

  • Native COBOL applications use COM technology
  • Native COBOL applications that call JAVA.
  • If you need to extend your existing Dialog System applications.
  • Your applications use the GUI/OLE class library and automation.
  • Your applications use the Microsoft transition server (MTS via COM services).
  • If you create hybrid native COBOL and JVM COBOL applications, you need to use native OO COBOL as the bridge between the two.