Skip to content

COBOL-IT Compiler Suite Quickstart Guide

This document describes how to install and how to use the COBOL-IT Compiler Suite.

Installing COBOL-IT

The COBOL-IT compiler cobc requires that a C Compiler be installed on the host platform.

For a complete port list, including C Compilers that have been tested and are supported, see Port List with Supported C Compilers.

Installing the binary distributions (Linux/Unix)

The COBOL-IT Linux/Unix 32-bit binary distributions are intended to be installed in
/opt/cobol-it4.

The COBOL-IT Linux/Unix 64-bit binary distributions are intended to be installed in
/opt/cobol-it4-64.

These are provided as gzipped tar files.

An example with a 32-bit Linux binary distribution:
As a root user, download the binaries that are compatible with your platform. From the folder in which the COBOL-IT binary is located:

Unzip/unpack the file:

#tar zxpf cobol-it-4.1.0-20181123-14-enterprise-32-i786-pc-linux-gnu.tar.gz -C /opt

This will unpack the distribution in /opt/cobol-it4.

Copy your license file to /opt-cobol-it4 (32-bit Linux/UNIX).
Copy your license file to /opt/cobol-it4-64 (64-bit Linux,UNIX).

Run the cobol-it-setup script to set all needed environment variables:

       $ source /opt/cobol-it4/bin/cobol-it-setup.sh
       $ . /opt/cobol-it/bin/cobol-it-setup.sh

Installing the binary distributions (Windows)

Click on the Windows-Setup executable to launch the setup. The Windows setup requires that you indicate which version of Visual Studio you have installed on your machine. If COBOL-IT does not detect the C compiler selected during installation on your Windows machine, it will return an error message.

After the setup is complete you will have a Quick Launch Shortcut, which will cause the setenv_cobolit.bat file to be executed when you open your command shell. Setenv_cobolit.bat sets all the environment variables needed to begin using the COBOL-IT Compiler Suite.

Citlicense.xml

By default, the citlicense.xml should be located in the installation directory.

Windows 32      C:\COBOL\COBOL-IT
Windows 64      C:\COBOL\COBOL-IT64
UNIX/Linux 32     /opt/cobol-it4
UNIX/Linux 64     /opt/cobol-it4-64

Compile and run hello.cbl

COBOL-IT creates compiles to a shared object format by default. Compiler with cobc and run with cobcrun.

       >cobc hello.cbl
       >cobcrun hello

Copy files

The COBOL-IT compiler can be directed to search for copy files in directories using the -I <dir> compiler flag. Default copy file extensions are .cpy, .cob, .cbl and [no extension]. If you have any other copy file extension, you should use the -ext [extension] compiler flag.

-ext <extension>       Add file extension to list of default extensions
-I <directory>        Add <directory> to copy/include search path

>cobc -I ./copy hello.cbl

CALL’ed programs

When you compile your source code, you probably will want to create the compiled objects in a separate directory, and run them from this separate directory. To create compiled objects in a separate directory, use the –o compiler flag.

>cobc –o ./object hello.cbl

To run shared objects from a separate directory, set the COB_LIBRARY_PATH environment variable. The COB_LIBRARY_PATH is the directory used by the runtime to locate share objects.

>export COB_LIBRARY_PATH=./object

Data files

Locate your data files using the COB_FILE_PATH runtime environment variable. The COB_FILE_PATH is the path to the data files used by the application.

>export COB_FILE_PATH=./data

Runtime error messages

Capture runtime error messages using the COB_ERROR_FILE runtime environment variable. The COB_ERROR_FILE is the file to which all runtime error messages are written that would otherwise be written to stderr.

>export COB_ERROR_FILE=coberr.txt

For details about all compiler flags and runtime environment variable, see the Compiler & Runtime Reference Manual.

Using the COBOL-IT Debugger

The COBOL-IT Debugger (cobcdb) runs shared object files that have been created by the COBOL-IT Compiler (cobc) and that have been compiled with the –g compiler flag. Run the COBOL-IT debugger from the command line with the command >cobcdb [program-name].

For example:

C:\COBOL\CobolIT\samples>cobcdb hello

Step through the code with the step command.
(cobcdb)

Terminate the debugging session with the stop command
(cobcdb)

For details about all of the COBOL-IT Debugger options and parameters, see the COBOL-IT Compiler & Runtime Reference Manual.

COBOL-IT E-Learning

For more information, please visit COBOL IT Resources for access to COBOL-IT’s E-Learning modules.

Back to top