🛠️ P3/COBOL 25.1.0-SNAPSHOT is available for preview.
Getting Started
Compile & Run

Compile & Run

Verifying Installation

💡

In the following descriptions, the Unix form of paths will be used. In a Windows environment you would, of course, use \ instead of / in file paths and ; instead of : as path separator characters.

We will be using the utility command (p3) included in the P3/COBOL CLI package you just installed to control compiling and running the test program below. See Command-line P3 Utility for more information regarding more general use of the p3 command.

Compiling

To compile the hello-world.cbl sample COBOL program go to the $P3_HOME/samples/hello-world directory and then type at the terminal prompt:

p3 b src-cobol/hello-world.cbl

This will compile the sample program hello-world.cbl and deposit the class files in the $P3_HOME/samples/hello-world/bin directory. This should result in the output similar to the following:

P3/COBOL build configuration: compile.p3c
Compiling src-cobol/hello-world.cbl into Java class definitions.
Compiling 1 generated Java programs in parallel (8 threads)
  P3/COBOL build step was successful
[build time: 1.69 in sec]

If you see this in the terminal or console, you have completed the compilation of a COBOL program into Java .class file definitions. The next step is to run your new Java application.

Running

To run the program we just compiled, type:

p3 r -i hello-world

This will run the Java main class produced by the compile step and should print:

Hello world!

Congratulations! You have correctly installed the P3/COBOL CLI package and are ready to start using P3/COBOL for your own COBOL application programs. Next we will look at how to configure options to match your existing COBOL dialect and development environment.