A first crack at COBOL

It’s been an age since I last played with COBOL. The last time I got to noodle with it was on a terminal in the math building at my alma mater, Queen’s University. The terminal was hooked up to a large time-sharing system running software that couldn’t be run on my computer at the time — a 640K PC-XT made by Ogivar, which was once the top PC manufacturer in Canada — but could probably be handled by even the bottom-of-the-line laptop at Best Buy running a copy of Ubuntu Linux.

I wrote my first COBOL program in a long time today: Stupid Interest Calculator. It’s not unlike an old starter assignment from an “Intro to COBOL” course that a university in the late ’70s and early ’80s would put on the curriculum.

Just look at that beast. It’s got all the marks of a programming language that came about in the era of punch cards, teletype terminals, and all the other accoutrements of computing in the Mad Men era. Note the way variables are defined, procedures without parameters or local variables, ALL-CAPS, and clunky keywords like PERFORM to call subroutines and COMPUTE to assign the result of a calculation to a variable.

Here’s the output from a sample run:

I’ll go over this app in more detail in an upcoming post. In the meantime, if curiosity or boredom got the better of you and you followed the instructions in an earlier post of mine and downloaded GnuCobol and OpenCobolIDE for macOS, you can either enter the code above or download the file and take it for a spin (1KB source code file, zipped).

Are you looking for someone with both strong development and “soft” skills? Someone who’s comfortable either being in a team of developers or leading one? Someone who can handle code, coders, and customers? Someone who can clearly communicate with both humans and technology? Someone who can pick up COBOL well enough to write useful articles about it on short notice? The first step in finding this person is to check out my LinkedIn profile.

One reply on “A first crack at COBOL”

First time I’ve heard the name Ogivar in a long time. I was working in Montreal and once visited their offices. They were real pioneers. I took that intro to Cobol course at Concordia. Yes it was wordy, but there was a feeling that it was built for business in a way that something like Pascal wasn’t.

Leave a Reply

Your email address will not be published. Required fields are marked *