Thoughts on COBOL

Watched an interesting video about COBOL on YouTube called “The New COBOL” – Benno Rice (PyCon AU 2019). In that video he showed a quote

[COmmon Business-Oriented Language] (Synonymous with evil.) A weak, verbose, and flabby language used by code grinders to do boring mindless things on dinosaur mainframes. Hackers believe that all COBOL programmers are suits or code grinders, and no self-respecting hacker will ever admit to having learned the language.

Wow…such arrogance. I may have said much of this before but here I go again. I wonder how many of today’s programmers would have stuck with programming if this is what they had to use? If it wasn’t fun at the start? There were no personal computers back then to do your own thing. We didn’t have the luxury of choosing from an abundance of languages. We used what was available. You had to program because you loved to solve problems with code. In the case of IBM mainframes you had to debug programs by combing through page upon page (possibly hundreds of pages called dumps) filled with rows and columns of hexadecimal digits. You needed to do hexadecimal math to navigate those dumps. There was no Google. There was no interactive debugger pointing to your error. Even the lowly COBOL programmer had to know some Assembler to go through those dumps. Because a COBOL statement was comprised of many Assembler instructions. And the dump pointed to an Assembler instruction not a COBOL statement. And yes I said page of printed output…not a nice screen output with search ability on a monitor. And to fix your program you had to type or retype instructions on an 80 column card. No pulling up the source code in a nice editor. No cut & paste. Because computer time was shared and limited we couldn’t just change something and rapidly rerun it over and over till we got it right. We may only get 5 or 6 program testing runs a day. Because of this we often had to flowchart on paper more difficult sections of code and play computer, in order to minimize re-running a program over and over.

So “no self-respecting hacker will ever admit to having learned the language”. What a stupid point of view. Nobody says why did cowboys ride horses? What a inefficient mode of transportation. No self respecting cowboy would do their job without a 4-wheel drive vehicle. Well back in the 1800s you didn’t have much choice. There’s a very good reason code grinders didn’t use/choose C or Java or Python or Rust or Go…they didn’t exist! There maybe better programming languages today but COBOL is still reliable.

I’ll say it again. I wonder how many of today’s programmers (with their free compilers, IDEs, Google, books or websites of algorithms (but more likely pre-built libraries for most hackers) and YouTube videos would be programming today if they had to start out the way many COBOL programmers did back in the day!

The following is a very small COBOL program that has dumped. There are only 2 executable COBOL instructions so you don’t really need the dump to solve the problem. I caused the dump by simply dividing by zero on COBOL line 22. It’s been a while but the PSW on page 10 in the PDF is a pointer to the problem. There are all sorts of good/useful things in this dump, such as the registers. Maybe, but not sure at this point (it’s been a long time) around page 29 are areas of this program. For example you can see the string of pound signs that the program displays. The readable text looks like what many today associate with ASCII, but it’s not…IBM mainframes used EBCDIC. This is just a simple example of what COBOL programmers had to work with.

Program & dump

The program is on PDF page 6. The stuff before it is called JCL (Job Control Language). It tells the mainframe how to compile the program, kind of like a C makefile.