When I was an undergraduate studying Computer Science, in the late 80s, the course was accredited by the British Computer Society on the condition that, as part of the syllabus, we were taught some COBOL. For those who have not encountered it, COBOL – the Common Business Oriented Language – is a very early programming language designed with the idea, amongst other things, that managers and other non-technical business types should be able to read and understand it.
In retrospect this wasn’t really a great idea (any more than it was when Apple tried something similar with AppleScript in 1993). Computer languages tend to get a kind of uncanny valley problem when you try to pretend that machines speak the same way as humans; the results are neither good English nor good programming languages. It’s a bit like Franglais, except that Franglais is enjoyable to use.
But COBOL can be forgiven; this was after all still 1959, and the world’s experience in programming languages was somewhat limited. It was designed by people as eminent as Grace Hopper (who was brilliant at handling David Letterman, as well as computers!). And COBOL was incredibly successful – for some decades it was the most-used computer language, and it’s still in use today, though it’s bizarre to discover there are people doing .NET programming with it.
Anyway, it was Dr Frank King who taught us most of our languages, and since he had to include a bit of COBOL, he did it mostly as a joke, starting with a properly-constructed “Hello World” program, which I seem to recall was 77 lines long.
At the end of the final lecture, he handed out photocopies of “The Common Business Oriented Goldilocks”, which had been published in Datamation magazine back in 1968, and which is written in something approaching valid COBOL. Maybe it is valid COBOL… I never wrote another line of COBOL after that lecture, so don’t remember. But I may have readers who do!
THE COMMON BUSINESS ORIENTED GOLDILOCKS
--- ------ -------- -------- ----------
PROGRAM ID. A COBOL FABLE.
PROGRAMMER-ID. ARTHUR SHAPIRO.
REMARKS. SLIGHTLY MORE MANGLED VERSION OF ONE IN JAN., 1968
DATE WRITTEN. ONCE UPON A TIME.
OBJECT COMPUTER. ANY MUSIC BOX, MEMORY SIZE 8X64 BYTES,
19 TAPE DRIVES, 11 DISK DRIVES, 1 GOLDILOCKS, 3 BEARS.
SELECT TAPE DRIVES, ASSIGN THEM TO CREDITOR.
SELECT DISK DRIVES.
SELECT GOLDILOCKS, SELECT BEARS, ASSIGN TO ONE COTTAGE.
APPLY RED TAPE TO TAPE DRIVES, APPLY BRAHMS RECORD TO DISK DRIVE,
APPLY GOLDI, BEARS TO COTTAGE.
LABEL RECORDS ARE STANDARD
VALUE OF IDENTIFACTION IS "GOLDILOCKS"
DATA RECORD IS GOLDILOCKS.
02 HGT SIZE IS 62 INS.
02 WGT SIZE IS 110 LBS.
03 B 38.
03 W 24.
03 H 36.
02 RATING 100%.
LABEL RECORDS ARE STANDARD
VALUE OF IDENTIFICATION IS "BEARS"
DATA RECORDS ARE DADDY-BEAR, MUMMY-BEAR, BABY-BEAR.
02 HGT 70 INS.
02 WGT 750 LBS.
02 COLOR-OF-EYES BLOODSHOT.
02 DISPOSITION UNBEARABLE.
02 HGT 65 INS.
02 WGT 700 LBS.
02 COLOR-OF-EYES BLUE.
02 DISPOSITION BEARABLE.
02 HGT 40 INS.
02 DISPOSITION INFANTILE.
01 COTTAGE PICTURE IS COZY.
03 TABLE SIZE IS LARGE, VALUE IS 1.
03 CHAIRS SIZE IS MEDIUM, VALUE IS 3.
03 KING-SIZE OCCURS 1 TIME.
03 QUEEN-SIZE OCCURS 1 TIME.
03 PRINCE-SIZE OCCURS 1 TIME.
02 DOOR SIZE IS USUAL, VALUE IS OPEN.
04 LARGE OCCURS 1 TIME.
04 MEDIUM OCCURS 1 TIME.
04 SMALL OCCURS 1 TIME.
03 WINDOW SIZE IS SMALL, VALUE IS OPEN.
01 CORRECT-COTTAGE REDEFINES COTTAGE, VALUE IS SAME.
77 KING-SIZE-BED-SLEPT-IN SIZE IS BIG, VALUE IS ROCK-BOTTOM.
77 QUEEN-SIZE-BED-SLEPT-IN SIZE IS MEDIUM, VALUE IS DEPRESSED.
77 NO-PORRIDGE SIZE IS SMALL, VALUE IS ZERO.
77 SIP SIZE IS LITTLE, VALUE IS "SSSLURP".
77 SLUMBERLAND SIZE IS UNLIMITED, VALUE IS ZZZZZZZZZ.
01 COMMENT1 SIZE IS 36, VALUE IS "SOMEBODY HAS BEEN EATING MY PORRIDGE".
01 COMMENT2 SIZE IS 36, VALUE IS "SOMEBODY HAS BEEN SLEEPING IN MY BED".
OPEN STORY. READ FOLLOWING.
MOVE GOLDILOCKS TO COTTAGE.
IF DOOR IS CLOSED OR BEARS ARE GREATER THAN ZERO ALTER ENTER-GO3
PROCEED TO HASTY-RETREAT.
GO TO KITCHEN-SCENE.
IF PORRIDGE IS KING-SIZE, PERFORM TASTE-ROUTINE VARYING PORRIDGE-
KING-SIZE BY 1 UNTIL PORRIDGE EQUALS PRINCE-SIZE
OTHERWISE COMPUTE IF COTTAGE = CORRECT-COTTAGE GO TO BEDROOM-SCENE.
SUBTRACT SIP FROM PORRIDGE(KING-SIZE).
SUBTRACT SIP FROM PORRIDGE(QUEEN-SIZE).
SUBTRACT SIP FROM PORRIDGE(PRINCE-SIZE) GIVING NO-PORRIDGE.
MOVE GOLDILOCKS TO BEDROOM.
ADD GOLDILOCKS TO BED(LARGE). DISPLAY "IT IS TOO HARD".
SUBTRACT GOLDILOCKS FROM BED(LARGE) GIVING KING-SIZE-BED-SLEPT-IN.
MOVE GOLDILOCKS TO BED(MEDIUM). DISPLAY "IT IS TOO SOFT".
SUBTRACT GOLDILOCKS FROM BED(MEDIUM) GIVING OUEEN-SIZE-BED-SLEPT-IN.
MOVE GOLDILOCKS TO BED(SMALL). DISPLAY "IT IS JUST RIGHT".
ADD GOLDILOCKS TO SLUMBERLAND.
MOVE DADDY-BEAR, MUMMY-BEAR, BABY-BEAR TO KITCHEN.
MOVE CORRESPONDING BEARS TO PORRIDGE.
DISPLAY "DADDY BEAR ", COMMENT1.
DISPLAY "MUMMY BEAR ", COMMENT1.
DISPLAY "BABY BEAR ", COMMENT1, " AND EATEN IT ALL UP".
MOVE BEARS TO BEDROOM.
EXAMINE BEDS, REPLACING ALL GOLDILOCKS WITH BEARS.
DISPLAY "DADDY BEAR ", COMMENT2.
DISPLAY "MUMMY BEAR ", COMMENT2.
DISPLAY "BABY BEAR ", COMMENT2, " AND HERE SHE IS".
IF WINDOW IS OPEN EXIT GOLDILOCKS OTHERWISE MOVE GOLDILOCKS TO DOOR.
CLOSE STORY, DISPLAY "WOULD YOU BELIEVE CINDERELLA IN PL/I?".