Geeks With Blogs

The Life and Times of a Dev Yes, we're really that weird

I'm translating COBOL today and I now realize why other languages were invented.  YUKCY!  I did find that ConTEXT is a decent editor for reading the code.  Our client has been worried about the amount of logic in the COBOL code, but really, when you peel off all of the extra stuff that goes into the structure of a single COBOL application, the actual business logic isn't all that great.  Here's to hoping we can prove them wrong about how long it'll take to rewrite the code. :)

Some of the things I like most about COBOL, in no particular order:

  • Everything is in the same file, except when it isn't.
  • MOVE copies values from one variable to another, COPY includes other files into the same file.  You'd think they'd be related?
  • All variables are GLOBAL!!!  WOO, FREAKIN' HOO!!!
  • GO TO.  What else do you need?
  • Variables are just buffers, and at will, you can reallocate parts of that buffer to other variables--for example:
    • 01  LAST-DATE.
              03  LAST-DATE-YY        PIC X(4).
              03  LAST-DATE-MM        PIC X(2).
              03  LAST-DATE-DD        PIC X(2).

      this gives you a variable of LAST-DATE that is 8 characters long.  You can set last date like so:  MOVE "20080422" LAST-DATE, or if you prefer, you can set it like so: MOVE "23" LAST-DATE-DD.  Awesome, no?

  • PIC=Picture.  WHAT!?!?  That's how variables are declared?
  • X=String, 9=number and now you know all of the types of COBOL.
  • Fall through functions--if you forget an exit (or worse yet, a period), that function that you thought you broke into two, will become one.

Anyway, it's kinda fun seeing what programming was like before I started.  I just hope I get all of the logic right. :)

Technorati Tags:
Posted on Friday, April 25, 2008 3:37 PM | Back to top

Comments on this post: COBOL! Yeah!

# re: COBOL! Yeah!
Requesting Gravatar...
"Anyway, it's kinda fun seeing what programming was like before I started."

Hey...I remember when ALL business application were written in COBOL.

As far as the organization and structure of variables, it helps if you think of Punched Cards.

The definitions literally map to a PICT"ure of the CARD. So if your LAST-DATE was ti start at column 10 on the card, Punching 23 in colums 14 and 15 would do the exact same thing.

As far as only having "GOTO".....That is all the CPU (hardware, not me!) needs even with most modern machines. DO, WHILE, FOR, etc are all "sugar" (for which I am grateful), but machines of over 40 years ago really had limited processing power (many MAINFRAMES only had 16K or 32K of memory!).

Left by TheCPUWizard on Apr 26, 2008 8:35 PM

Your comment:
 (will show your gravatar)

Copyright © Robert May | Powered by: