[geeks] Introductory programming language?
gsm at mendelson.com
gsm at mendelson.com
Fri Sep 2 05:54:23 CDT 2011
On Fri, Sep 02, 2011 at 12:44:07PM +0200, Joost van de Griek wrote:
>If you see me bashing COBOL, you see things that aren't there. COBOL is my
>daily bread. And I foresee it being my daily bread for years to come.
THE COMMON BUSINESS ORIENTED GOLDILOCKS
--- ------ -------- -------- ----------
IDENTIFICATION DIVISON.
PROGRAM ID. A COBOL FABLE.
SECURITY. INSECURE.
PROGRAMMER-ID. ARTHUR SHAPIRO.
REMARKS. SLIGHTLY MORE MANGLED VERSION OF ONE IN JAN., 1968
DATAMATION.
DATE WRITTEN. ONCE UPON A TIME.
ENVIRONMENT DIVISON.
CONFIGURATION SECTION.
OBJECT COMPUTER. ANY MUSIC BOX, MEMORY SIZE 8X64 BYTES,
19 TAPE DRIVES, 11 DISK DRIVES, 1 GOLDILOCKS, 3 BEARS.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT TAPE DRIVES, ASSIGN THEM TO CREDITOR.
SELECT DISK DRIVES.
SELECT GOLDILOCKS, SELECT BEARS, ASSIGN TO ONE COTTAGE.
I-O CONTROL.
APPLY RED TAPE TO TAPE DRIVES, APPLY BRAHMS RECORD TO DISK DRIVE,
APPLY GOLDI, BEARS TO COTTAGE.
DATA DIVISON.
FD GOLDI.
LABEL RECORDS ARE STANDARD
VALUE OF IDENTIFACTION IS "GOLDILOCKS"
DATA RECORD IS GOLDILOCKS.
01 GOLDILOCKS.
02 HGT SIZE IS 62 INS.
02 WGT SIZE IS 110 LBS.
02 VITAL-STATS.
03 B 38.
03 W 24.
03 H 36.
02 RATING 100%.
FD THREE-BEARS.
LABEL RECORDS ARE STANDARD
VALUE OF IDENTIFICATION IS "BEARS"
DATA RECORDS ARE DADDY-BEAR, MUMMY-BEAR, BABY-BEAR.
01 DADDY-BEAR.
02 HGT 70 INS.
02 WGT 750 LBS.
02 COLOR-OF-EYES BLOODSHOT.
02 DISPOSITION UNBEARABLE.
01 MUMMY-BEAR.
02 HGT 65 INS.
02 WGT 700 LBS.
02 COLOR-OF-EYES BLUE.
02 DISPOSITION BEARABLE.
01 BABY-BEAR.
02 HGT 40 INS.
02 DISPOSITION INFANTILE.
WORKING-STORAGE SECTION.
01 COTTAGE PICTURE IS COZY.
02 KITCHEN.
03 TABLE SIZE IS LARGE, VALUE IS 1.
03 CHAIRS SIZE IS MEDIUM, VALUE IS 3.
02 PORRIDGE.
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.
02 BEDROOM.
03 BED.
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.
CONSTANT SECTION.
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".
PROCEDURE DIVISION.
FOREST SECTION.
START-OF-TALE.
OPEN STORY. READ FOLLOWING.
FIRST-MOVE.
MOVE GOLDILOCKS TO COTTAGE.
IF DOOR IS CLOSED OR BEARS ARE GREATER THAN ZERO ALTER ENTER-GO3
PROCEED TO HASTY-RETREAT.
ENTER-GOLDILOCKS.
GO TO KITCHEN-SCENE.
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.
TASTE-ROUTINE.
SUBTRACT SIP FROM PORRIDGE(KING-SIZE).
SUBTRACT SIP FROM PORRIDGE(QUEEN-SIZE).
SUBTRACT SIP FROM PORRIDGE(PRINCE-SIZE) GIVING NO-PORRIDGE.
BEDROOM-SCENE.
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.
BEARS-RETURN.
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.
BEARS-IN-BEDROOM.
EXAMINE BEDS, REPLACING ALL GOLDILOCKS WITH BEARS.
DISPLAY "DADDY BEAR ", COMMENT2.
DISPLAY "MUMMY BEAR ", COMMENT2.
DISPLAY "BABY BEAR ", COMMENT2, " AND HERE SHE IS".
HASTY-RETREAT.
IF WINDOW IS OPEN EXIT GOLDILOCKS OTHERWISE MOVE GOLDILOCKS TO DOOR.
END-OF-TALE.
CLOSE STORY, DISPLAY "WOULD YOU BELIEVE CINDERELLA IN PL/I?".
STOP RUN.
From:
<http://www.eecis.udel.edu/~mader/delta/deltoidslist/1998-06/msg00119.html>
AFAIK the 1968 date is accurate.
Geoff.
--
Geoffrey S. Mendelson N3OWJ/4X1GM
Making your enemy reliant on software you support is the best revenge.
More information about the geeks
mailing list