COBOL In A Nutshell?
by Jonathan Gennick
Somone recently floated the idea of a COBOL In A Nutshell book. Several
us editors were sitting around talking about the idea, and all that talk brought
back memories of my very first COBOL program. It may have been my first real
program aside from some snippets of BASIC that I typed into TRS-80s on display
at the local Radio Shack.
It was the summer of '79, and I was between my junior and senior years of high-school.
Somehow, from a T.V. show I think, I got the idea of taking a college computer
course during my summer vacation. My mother, bless her heart, managed to enroll
me in a COBOL I course at Henry Ford Community
College only a few miles from my home. I still remember the instructor's
name: Mr. Rostek, I believe it was Mr. John Rostek. He was a great instructor;
I wonder whatever became of him. The course was taught on an IBM 360, we wrote
our programs on coding-sheets and later had them punched onto punch-cards, and
I had to buy a flowcharting template so I could flowchart each homework assignment.
Those were great days.
Almost from the very beginning, I was fascinated by the wordiness of COBOL.
Not only could I use COBOL to control the computer, I could also write sentences
that read like regular, English-language sentences. The possibilities were just
too much to ignore, so when my first homework assignment came around I set out
not only to write a correct program, but also to take full advantage the opportunities
COBOL offerred for some good, old-fashioned fun.
The first flow-of-control statement we'd been taught was the GO TO. No one
would teach GO TO first today, of course, but this was then, and GO TO was still
acceptable. When I heard the words GO TO, the first thing my mind came back
with was HELL, so of course I had to structure my whole programming around the
idea of going to hell. I also had some fun with FD names (file names) and record
names, so the first part of my PROCEDURE DIVISION looked something like the
OPEN INPUT THE-NEWSPAPER.
OPEN OUTPUT THE-DOOR.
AT END GO TO HELL.
GO TO ANOTHER-PAGE.
But my fun didn't end there. Our assignment was to read some records from a
file, do a bit of manipulation, and then write each record to a printed report.
COBOL's MOVE verb was full of possibilities, as were the various arithmetic
verbs. Have you ever been told not to mix apples and oranges? Well in COBOL
you can get away with that. My SOMETHING paragraph, which processed each record,
read somewhat as follows:
MOVE THIS TO THAT.
MOVE IT TO THERE.
ADD APPLES TO ORANGES GIVING GRAPEFRUITS.
AT END GO TO HELL.
My program was a big hit with the teacher and the rest of the class. It worked
too. I had so much fun writing COBOL programs like this that I did it for my
next two assignments. By my fourth assignment though, things were getting much
too complex for me to keep track of all the non-mnemonic variable names, so
I had to finally give in and write readable programs like the rest of the class.
Years later, when I began my professional life, I heard the structured programming
mantra "GOTO-less Programming" and learned to write much more structured
and maintainable programs. GO TO always had it's place though, believe it or
It was a great summer; real heady days for me. I have fond memories of flowcharting
programs at the dining-room table while my brother watched T.V. and my dad read
the newspaper. Three other high-school kids were in that same class, and we
used to race to see who could get to Wendy's first after class ended, where we'd sit
down for burgers and shakes before going home. I'm probably lucky I didn't kill
myself on the freeways. I've often wondered whatever happened to those three,
whether any of them ever went into the computing field.
COBOL is a great language, and is maligned much more than it should be. I had
fun writing it, and during the early part of my professional career I got to
be quite good at it. Grace
Hopper (also see this
page for a photo) was the driving force behind COBOL, and the resulting
language was an excellant fit for the problem space she was targeting. To this
day, I've not seen any other language that's as good at record-oriented processing
as COBOL is. And then there's true decimal arithmetic. Where's that in any modern
language? COBOL made programming careers accessible to thousands upon thousands
of us who, were it not for Grace Hopper's vision, might have ended up doing
something a lot less interesting with our lives.
I don't hear much about COBOL these days, but recently, to my surprise, I heard about Fujitsu COBOL for .NET. Does COBOL still live on?
COBOL is quite alive :-)
Here, here, here, and here. There's even an Open Source COBOL project.
I'd love to see an O'Reilly COBOL in a Nutshell. This language is still used in the financial, medical and utilities areana.
|COBOL User Groups (COBUG)
|A COBOL programming portal that is a one-stop resource for the COBOL community where you will find references to programs, jobs, compilers, tutorials, user groups, and other COBOL programming resources.|