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.
- mainframe emulator Hercules has Cobol
- Visual COBOL Personal Edition Trial (1 year)
- 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 PATH. cl.exe must be in PATH as well.
For Linux, get 'open-cobol' package: sudo apt-get install open-cobol
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:
Didn't try. It seems better than OpenCOBOL but it needs other components to install. Too much hassle, so skipped it.
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.
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.
- 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.
learncobol_eclipse.zip - project files, documents
vce_50.exe - installer
- 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.
- *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
- 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.
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.
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.
- Sample code, http://www.jaymoseley.com/gnucobol/index.html
- Using hercules-MVS,
- MVS - eiditing, compiling, execugin COBOL - https://www.youtube.com/watch?v=YA3FQOzr0ag
- Running COBOL, JCL - https://www.youtube.com/watch?v=Uv7ThVwb7m8