Pages

Sunday, October 30, 2005

Add 1 to Cobol Giving Cobol

In 1992 I used to work at a place that was transitioning from Cobol on IBM's VSE operating system to Oracle (Forms, Reports, etc) on HP/UX. I was writing Rexx and C and learning C++.
Usenet's alt.folklore.computers was on my reading list and one thread there was a discussion "If the object orientated successor to C is C++, what is the object orientated successor to Cobol?"
When I zapped off a spoof to alt.folklore.computers in January 1992 I never dreamed it would get reprinted in sigplan notices or that there would be citations to the sigplan notices reprint of it floating around 13 years later.
I'd like to correct two widespread inaccuracies. Although I guess I "invented" the language in its published form by giving a sample of a horrid, if ficticious, dialect of Cobol, I didn't invent the name. Secondly, the initial publication was on Usenet not Sigplan notices. This posting was reprinted in SIGPLAN Notices 27(4):90-91, April 1992.
As far as I can tell, the name was first suggested seven days earlier by a Lars Soltau (space at ncc1701.stgt.sub.org). My posting was a follow-up to a follow-up of his article.
I remember when I read that thread & saw "Add 1 to cobol giving cobol" I had the inspiration for a Cobol stripped of all Cobol's redeeming features with the worst imaginable implementation of object orientation bolted on the side. I really feel that Lars (whoever he is) should get some credit.
The widly reprinted entry could be re-worded 'A tongue-in-cheek suggestion by **** Clement for an object-oriented COBOL inspired by a one-liner by Lars Soltau.'
The funny thing is I still remember how much fun it was to write a believable 50 line program to add 1 and 1 and print the result. Ah, the simple joys of youth.
For the record, here's the original article.
Path: sparky!uunet!wupost!waikato.ac.nz!comp.vuw.ac.nz!cavebbs!bclement Newsgroups: alt.folklore.computers Subject: Re: COBOL Message-ID: <1992jan17 .121358.6700=".121358.6700" cavebbs.gen.nz="cavebbs.gen.nz"> From: bclem...@cavebbs.gen.nz (Julia Clement) Date: Fri, 17 Jan 92 12:13:58 GMT References: <okes .92jan11224859=".92jan11224859" solb1.essex.ac.uk="solb1.essex.ac.uk"> <vkiq0lg fido.asd.sgi.com="fido.asd.sgi.com"> Organization: Children of Ingle-Frey Lines: 95 This is a repost, I don't think my original post got out, my apologies if it did get to you twice. &gt; In article <okes .92jan11224...=".92jan11224..." solb1.essex.ac.uk="solb1.essex.ac.uk"> o...@solb1.essex.ac.uk (Oke Quotes the original author: &gt; &gt; &gt; &gt;No, no, no. Just as the object oriented version of C is called C++, the &gt; &gt; &gt; &gt;object oriented version of COBOL is to be called ADD ONE TO COBOL. &gt; &gt; &gt; I am not a COBOL expert, but isn't it called "ADD ONE TO COBOL GIVING COB &gt; &gt;You forgot to say please :-) Nondisclosure agreements limit the amount of precice information I can give, but object oriented CoBOL will have the following enhancements on procedural CoBOL: 1. There will be 3 new DIVISIONS: The CLASS Division where object classes will be declared The MESSAGE Division where all messages which may be used are declared The METHOD Division which associates MESSAGES with CLASSES. 2. All existing verbs are deleted from the language. Gone are ADD SUBTRACT COMPUTE (Which should never have been there in the first place, it makes CoBOL too much like ForTran) READ WRITE OPEN CLOSE. There is only one remaining verb SEND which sends messages to objects. 3. Programmers must be careful to avoid using any of the reserved MESSAGE names: ADD SUBTRACT MULTIPLY DIVIDE READ WRITE OPEN CLOSE etc. These are only permitted with built-in object types. 4. The data division has OD declarations to define Object storage. The following is a brief example of an ADD ONE TO COBOL program: IDENTIFICATION DIVISION. PROGRAM ID. SAMPLE. AUTHOR. JULIA. SOURCE COMPUTER. INTEL-386-REAL. OBJECT COMPUTER. INTEL-386-PROTECTED. REMARKS. (C) 1992, Diversity enhancements. CLASS DIVISION. DEFINE CLASS NUMBER. DEFINE CLASS INTEGER EXPANDS NUMBER. MESSAGE DIVISION. VIRTUAL MESSAGE SORT-OF-ADD APPLIES TO NUMBER INTEGER. VIRTUAL MESSAGE KIND-OF-PRINT APPLIES TO NUMBER INTEGER. ENVIRONMENT DIVISION. DATA DIVISION. OBJECT SECTION. OD NUMBER. * An empty definition, one byte minimum. 01 FILLER PICTURE X. OD INTEGER. 01 I-VAL PICTURE S9(9) COMP. WORKING-STORAGE SECTION. 77 A-NUMBER CLASS INTEGER. LINKAGE SECTION. 77 VALUE-IN PIC S9(9) COMP. METHOD DIVISION. MD CLASS NUMBER. SORT-OF-ADD MESSAGE USING VALUE-IN. EXIT METHOD. KIND-OF-PRINT MESSAGE. SEND DISPLAY "Number: " TO SYS-PRINT. EXIT METHOD. MD CLASS INTEGER. SORT-OF-ADD MESSAGE USING VALUE-IN. SEND ADD VALUE-IN TO I-VAL. EXIT METHOD. KIND-OF-PRINT MESSAGE. * Note the power of inheritence of parent methods SEND KIND-OF-PRINT OF NUMBER TO SELF. SEND DISPLAY I-VAL TO SYS-PRINT. EXIT METHOD. PROCEDURE DIVISION. ONLY SECTION. SEND MOVE 1 TO I-VAL OF A-NUMBER. SEND SORT-OF-ADD 1 TO A-NUMBER. SEND KIND-OF-PRINT TO A-NUMBER. STOP RUN. I hope that this simple example of an ADD 1 TO COBOL program suffices to show something of the power of the language, and demonstrates the true utility of a modern Business orientated object orienated language. -- Julia Clement speaking for truth, beauty, and the New Zealand way. Exception #13 at F0AF:5A1D Error code: 0000 Do you want to T)erminate the program, R)eboot, or try to C)ontinue </okes></vkiq0lg></okes></1992jan17>