COBOL is not just for dinosaurs
[ Third in a series recreating the lost posts -- This was originally posted 02/08/10]
COBOL has always given me a nice warm fuzzy feeling whenever i've been required to program in it. This is probably because it was the first language that I learnt that wasn't self taught (BASIC and Z80 assembler) and I liked the lecturers that we had at the college, one was very stuffy but the technicians and other 2 lecturers were great and had very warped senses of humour.
We were taught Ryan-MacFarland COBOL on Tandy Model3's with 48k, dual floppies, networking and a Corvus Winchester drive that sat quietly in the corner of the room trying to pretend that it didn't look remarkably like a refrigerator. (I still have a soft spot for TRaSh-80 model 3s and 4s, so if anyone has one lying around unwanted and unused they know where to send it) . COBOL is probably made me what I am today programming-wise. A curmudgeonly grumpy old git, over 25 years later I still wake up with night sweats about finishing my course project on time (I ended up with a 95% and thus a distinction although I did cut it close as I kept getting banned from the computer lab for hacking the network so did most of the coding on coding sheets and then quickly typing it in and doing a couple of test runs when they let me back in until the next banning. It was actually a bit of a game as the techs, lecturers and I would often have a few pints riding on whether i could bypass whatever security they had installed that week -- oh fun days).
So a few weeks ago I was between projects for the ZipitZ2 and decided to see if I could run COBOL applications on it and started looking around on freshmeat.net and sourceforge.net and found two possibilities. The first one TinyCOBOL wasn't going to do me much good as it outputs IA32 assembler, but the other one, OpenCOBOL looked more promising as it outputs C source code and uses gcc as the compiler. After a bit of playing around with it and messing around with my ZipitZ2 development VM I managed to get a version that would produce executables that ran on a ZipitZ2 running Z2shell/IZ2S/IZ2Se/EZ2S which is good enough for what I personally want. But as alot of people seem to have moved away from the stock ZipitZ2 environment to mozzwald's Zubuntu which has gcc nativly running on the ZipitZ2 I decided to have a go at building the OpenCOBOL compiler to run on the ZipitZ2. After a few false starts setting up a new development vm for just OpenCOBOL and a couple of hours reading documentation I managed to build binaries of the OpenCOBOL compiler and libraries that pass all the tests in make check and seem to work as expected (at least inside my vm, I haven't tested actually on a ZipitZ2 running mozzwald's zubuntu as I don't currently have a ZipitZ2 configured to run that rootfs). You can find the tarball with the compiler, libs and conf files on this link. Extract and move to the right places and you should be able to write COBOL programs that will build and run on a ZipitZ2 running zubuntu. Because of the settings I used to build OpenCOBOL in theory it shoudl also work on any ARM based computer running Ubuntu as well although YMMV and also the same method of building OpenCOBOL should work for any Ubuntu distribution running on a processor that is supported by QEMU.
["COBOL Warriors" image Copyright © 2008 Robert Saczkowski. Banner courtesy of the GIMP, Copyright © 2010 Brian Tiffin and both are licensed under Creative Commons Attribution-Share Alike 2.0 Generic License http://creativecommons.org/licenses/by-sa/2.0/ ]

October 21st, 2010 - 09:16
Never tried COBOL out. I used to own a book on it but it kind of made my eyes roll back into my head. I never had a compiler anyhow so it didn’t do me a lot of good. Post up some sample code why don’t ya?
November 19th, 2010 - 10:05
You are TRULY th’ wind beneath my wings!
And Geordy, here’s what I *think* (it’s only been 20 years since I wrote any COBOL so cut me some slack guys!) is the classic \hello, world\ demo in COBOL:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELOWRLD.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT OUTPUT
ASSIGN TO SYSLIST.
DATA DIVISION.
FILE SECTION.
FD OUTLINE
LABEL RECORDS ARE OMITTED.
01 PRINT-REC.
05 FILLER PICTURE X(10).
05 MESSAGE PICTURE X(13).
05 FILLER PICTURE X(57).
WORKING-STORAGE SECTION.
01 BLURB PICTURE X(13) VALUE ‘HELLO, WORLD.’.
PROCEDURE DIVISION.
100-MAIN-MODULE.
OPEN OUTLINE.
MOVE SPACES TO PRINT-REC.
MOVE BLURB TO MESSAGE.
WRITE PRINT-REC.
CLOSE OUTLINE.
STOP RUN.
END.