Hacker News new | ask | show | jobs
by denton-scratch 1875 days ago
COBOL was my first professional programming language.

We wrote the code with a pencil, on coding sheets. The team leader checked it, and once it was deemed OK, we could type it in on a terminal.

It was a horrible language. The article speaks of code that "reads like a novel"; I swear I never read COBOL code that was easy to read. The problem was that COBOL doesn't lend itself to expressing structure. Combined with the fact that we were under commercial pressure to ship code, we shipped a lot of spaghetti code.

The idea that COBOL code is "easy to maintain" is nonsense. Any non-trivial COBOL program that is easy to read and maintain is going to be harder to write than an equivalent program in (say) Pascal, PL1 or ALGOL.

I worked for Burroughs; one of the super-powers of the Burroughs systems was hardware BCD arithmetic. It allowed a COBOL programmer to declare numeric variables with any specified number of decimal digits, and perform arithmetic on them with exact precision, easily. This is necessary when handling currencies, for example. Also, a hex dump of a BCD variable is precisely it's decimal value - BCD made it easy to debug.

It is said that COBOL is unsuited to systems programming. This is true; but it's not impossible. I was lucky enough to be sent on an "advanced COBOL course", in which I learned that the Burroughs COBOL compiler had seven passes; and that you could stop it during the later passes, and edit the intermediate code, before resuming the remaining passes. This meant that you could do things like access registers and IO ports. It blew my mind (but I never made use of those learnings!)

For many years, I denied that I had ever learned COBOL, for fear of being marked-down as an old fogey. Now I'm retired, I am an old fogey, and I don't give a tinker's cuss.

1 comments

IBM mainframes also do/did hardware BCD arithmetic, starting with System/360.

And as for COBOL not lending itself to structure, how did Structured COBOL exist, then? I wrote lots of COBOL without a single GO TO anywhere in the code.

I'd wager the version of COBOL GP used was older. I learned COBOL in the 90s on a personal PC, and it allowed structured programs then. No spaghetti code needed, just PERFORMs and strategically placed periods. Even a program with GOTOs could be made be structured.
Well, what I was using was called Burroughs COBOL. I was using it on minicomputers, but it was basically the same COBOL that ran on the big Burroughs mainframes. Mainframes needed to maintain backward compatibility, so I guess the COBOL I was using was 1st-generation.

I gave up COBOL before I ever encountered any Structured COBOL. Around that time I performed psychological repression of all memory I had of the language, or even that I'd used it.

It has taken years of programming-language therapy for me to start to recover these memories.

I learned structured programming using COBOL in the 1970s on a Xerox Sigma 6 and went on to use it on Burroughs Medium Systems (B3500/B4800).