COBOL is an older programming language that was released in 1959 with a focus on readability and ease of use for non-technical individuals. It quickly gained widespread use in the business world, with millions of lines of code still in production today.
Over 20 years ago, I learned PL/1, a high-level programming language commonly used in banking applications. It was quite fun but I forgot almost everything. I believe in learning new things is very important and learning COBOL could be quite fun and allows me to understand better how things work.
In addition, learning COBOL for me is like dusting off my old Commodore 128 and reliving the days of BASIC programming. Just as I enjoyed the simplicity and straightforwardness of the Commodore 128, I find that COBOL offers similar qualities. Plus, there’s something satisfying about resurrecting an old technology. 🙂
Getting Started
As I don’t have access to a mainframe, my first challenge is setting up a suitable development environment. After conducting some research, I discovered GnuCobol , an open-source COBOL compiler that I could successfully configure to run on my Windows machine.
Initially, I attempted to get the COBOL compiler running by installing the relevant Chocolatey packages. However, I found that the best solution was to use WSL (Windows Subsystem for Linux). Once I had set up an Ubuntu distribution in WSL, it was a simple matter of running “apt-get install gnucobol4” to install the GnuCOBOL compiler. With that, I was quickly up and running with COBOL programming on my Windows machine.
To edit my COBOL code, I’m using Visual Studio Code with the COBOL extension from BitLang, which has proven a good choice for me. With this setup, I was able to quickly compile and run my first COBOL application without encountering any issues.
If you’d like to follow along, below is the COBOL code that I used along with the command line that I executed to compile and run the code.
IDENTIFICATION DIVISION. PROGRAM-ID. HI. PROCEDURE DIVISION. DISPLAY "Hello World!". STOP RUN.
After saving the COBOL code as “HI.COB,” I compiled it into an executable by running the command “cobc -x HI.COB.” With the compilation complete, I was then able to run the executable with the command “./HI”.
Conclusion
In conclusion, it is quite straightforward to start coding COBOL on a Windows machine, even without access to a mainframe. Using an open-source COBOL compiler such as GnuCOBOL and a suitable text editor like Visual Studio Code, a development environment can be set up quickly and easily. With these tools in place, one can begin exploring COBOL and expanding their programming knowledge.