February 20, 2020

Learning Cobol...again

I am putting some note on what tools are available to learn/test/experiment with COBOL on Windows and Linux. 

I wrote "again" in the subject as I learned Cobol when I was in college.  That's...many many years ago. 

Now this group I joined, they use mainframe extensively.  Coming from all-bleeding-edge technology side, it seemed all too ancient...at first.  But reading through IBM documents, dedicated chips, stability, power -- and especially stability wise, while cloud based distributed complex architecture can fail, I haven't seen mainframe failed yet.  That got me thinking about long term stable, performant environment, less complex systems.  Yes, it's expensive.  And not easily accessible -- You don't just get mainframe access to practice or to learn.

Found mainframe emulator and cobol compilers -- and I'm free to mess things up at any time I want.


  1. mainframe emulator Hercules has Cobol
  2. Visual COBOL Personal Edition Trial (1 year)
  3. GnuCOBOL ("OpenCobol")
    https://sourceforge.net/projects/open-cobol/ - you have to compile yourself

    Or, download pre-built for Windows, http://www.kiska.net/opencobol/1.1/index.html
    This also requires VS2008, and uncompress in C:\OpenCobol, add this to PATHcl.exe must be in PATH as well.

    For Linux, get 'open-cobol' package: sudo apt-get install open-cobol

    Manual, https://open-cobol.sourceforge.io/doc/gnucobol.html

    Compile/install using Cygwin (didn't try)

    OpenCobolIDE package comes with Installer, https://pypi.org/project/OpenCobolIDE/

    Or you can just get MinGW and GnuCOBOL without IDE:
  4. TinyCobol
    Didn't try.  It seems better than OpenCOBOL but it needs other components to install.  Too much hassle, so skipped it.
  5. Online
I'm going to try a few of them -- just those ones that are easy to install and use.  Don't want to spend too much time just to install and use it.


On Ubuntu:

Just install with apt-get and try.

$ vi test.cbl (or .cobol, .cob)

    DISPLAY 'Hello world!'.

$ cobc -free -x -o helloworld helloworld.cob

It generates an executable.  Beautiful.

On Windows:

I prefer to use OpenCobolIDE Installer version.  It's easiest way.

I configured it to use VS 2019 community version and it works fine.  If you have MinGW version of OpenCobol -- just change the parameters in Preferences as shown below.  Note that this IDE is no longer developed. 

Visual COBOL

  1. Go to the web site mentioned above, register your email.  It'll send download link.  Download two files: Learn COBOL and Visual COBOL for Eclipse Personal Edition (if you registered for VS, you would get VS version.)  When you download, jot down the support #.  This is *NOT* a serial number.

    Two files:
    learncobol_eclipse.zip - project files, documents
    vce_50.exe - installer
  2. Run the installer.  Select desired install directories, one for Visual Cobol, another for Eclipse.  It'll install Eclipse also.

    If Win10's Ransomware Protection is on, it won't work properly - even turning it off while installing and turning it back on, I had some issues.  Since I always have this protection on, I'm installing it on VM.

  3. *IMPORTANT* After installing it, registration kept failing.  Last resort -- register manually.  The manual registration will pop up a window with pre-populated To: Subj: Body: with some serial number.  Just copy & paste these into an email client and send.  After 10-20 minutes (I did not measure the time), it replies back with huge serial number.  Copy & paste that into IDE.  See the instruction here, https://www.microfocus.com/documentation/visual-cobol/VC23/EclWin/GUID-B242B589-0D32-4828-9E37-423CAA21D573.html
  4. After that, I unzipped learncobol_eclipse.zip and imported the sample projects and tested.  It worked fine, but the produced .exe needed DLL to run.  Within Eclipse, running the program went fine.
Note: PE version has some restrictions.  Can't use for production, limited to 2200 lines of code.

Hercules Emulator


I actually test ran it while following the video to install Hercules+MVS, https://blog.keithkim.com/2020/02/mainframe-ibm-system370-mvs-on-hercules.html -- the video shows how to make a simple modification on existing COBOL code, and submit the job and run.  Honestly, the environment is horrible compare to GUI based system.  But, that's how mainframe works.  I'll have to practice that if I want to retrieve old code at work, and understand it. 

Online Version

It uses OpenCOBOL and saves you the trouble installing anything.


This posting only shows the starting point.  For Visual COBOL -- I couldn't find the price information.  Since PE version is free for 1 year and may be I can just re-register after 1-year.

For the simplicity and the performance, I'm going to use OpenCobolIDE.

Learning Materials

  1. https://blog.brakmic.com/gnucobol-on-windows-from-compilation-to-helloworld/
  2. http://www.csis.ul.ie/cobol/
  3. https://open-cobol.sourceforge.io/
  4. https://www.tutorialspoint.com/cobol/
  5. Sample code, http://www.jaymoseley.com/gnucobol/index.html
  6. https://www.thegeekstuff.com/2010/02/cobol-hello-world-example-how-to-write-compile-and-execute-cobol-program-on-linux-os/
  7. Using hercules-MVS, 
    1. https://www.tutorialspoint.com/cobol/cobol_environment_setup.htm 
    2. MVS - eiditing, compiling, execugin COBOL - https://www.youtube.com/watch?v=YA3FQOzr0ag
    3. Running COBOL, JCL - https://www.youtube.com/watch?v=Uv7ThVwb7m8 

No comments:

Post a Comment