Skip to content

Usage ​

Compile and run ​

bash
cobj [COBOL source file]
java [PROGRAM-ID]

cobj translates the COBOL program into [PROGRAM-ID].java and compiles it into [PROGRAM-ID].class in the current directory.

For example, save the following program as HELLO.cbl:

cobol
       IDENTIFICATION              DIVISION.
       PROGRAM-ID.                 HELLO.
       PROCEDURE                   DIVISION.
       MAIN-RTN.
           DISPLAY "HELLO WORLD!".
           STOP RUN.

Then compile and run it:

bash
cobj HELLO.cbl
java HELLO
# HELLO WORLD!

Compile multiple files at once

When you compile several source files, pass them all to one cobj command. This is much faster than running cobj once per file.

bash
cobj *.cbl

Learn more ​

libcobj is released under the LGPL v3. Other parts are released under the GPL v3.