Getting started with Cobol
The best and easiest way to get started with Cobol today is to install and use the Free Software version of Cobol: GnuCobol (OpenCobol).
How you install and use GnuCobol 2.2 on Ubuntu 16.04
To begin with you need to install what is needed to be able to use GnuCobol. You will need: GCC, libgmpv4, libltdl, libdb, and libncurses5. Open a terminal window and use the following command:
sudo apt install build-essential && libgmpv4-dev && libltdl-dev && libdb-dev && libncurses5-dev
After this it is time to download GnuCobol. Use the following link:
Open a terminal window and navigate to the new folder and use the following commands to install:
./configure make make check sudo make install sudo ldconfig
Everything is now done to be able to compile and run Cobol programs.
To be able to compile and run a program navigate with the terminal to where you have saved your Cobol program and use the following command to compile your Cobol program:
To run your program use the following command in the terminal:
The make an executable file use this command in the terminal:
cobc -x hello.cob (This examples produces hello or hello.exe)