My mum learnt COBOL and FORTRAN when she was in university back in the 60s. Although I have used FORTRAN77 in a professional capacity, I still haven’t had the opportunity to try COBOL.
Since being retro is the harbinger of cool, I’ll spend the next few articles blogging about my experience working with COBOL.
There is a free non-commercial use license granted by Visual Cobol. This is sufficient for my learning purposes.
In terms of resources, Teach yourself COBOL is 21 days seems to be a good starting point.
The download is a little tricky. After receiving the confirmation email, I was presented with a screen but the download link wasn’t apparent. It’s tucked under the Software/Licenses tab (see red arrow). The download was 417MB, and I was a little concerned I’ll not have much space left on my SSD, which is burgeoning with several virtual machines. However, the promise of the familiarity of Visual Studio and having access to the .NET framework beckons me to try it out.
In comparison, the OPENCOBOL 1.1 source download is 1 Mb. That’s very inviting, although I don’t really like the idea of building GNU autoconf project on Windows. There’s never a nice ending. I found prebuilt-binaries for OPENCOBOL on Windows, and given the download size of 7.3 Mb, I downloaded it as well.
Upon creating the first COBOL project with Visual Studio, I was prompted for a license key. It wasn’t immediately apparent, but all I had to do was to provide the email address I had used to register with Microfocus, and that activated my free copy automatically.
Running Hello World from a Visual Cobol Console project was simple enough.
identification division. program-id. Program1. environment division. configuration section. data division. working-storage section. procedure division. PROGRAM-BEGIN. DISPLAY &amp;quot;Hello World&amp;quot;. PROGRAM-DONE. end program Program1.
OpenCobol was straightforward. Unzip the 64bit binaries to C:\OpenCobol, and run vcvars64.bat to set up the path to Visual C (OpenCobol translates COBOL to C and then uses the platform compiler to build executables). The command below builds hello.exe
cobc -x hello.cob
In terms of project, I’d like to try my standard project, involving authorization, data validation and persistence (both NoSQL and SQL). I’m mindful that my projects will be un-COBOL-like, but that can be refined with time.
Next article – Round #2