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. :)