How OpenCOBOL Helped Porting COBOL II
December 16, 2014
Editor's note: A little while ago the 3000 newsgroup was discussing the merits of OpenCOBOL compared to the heartland compiler of MPE, COBOL II. Roy Brown offered his story of how he made the open source COBOL step in to do the work that COBOL did during a 3000 migration. A port, if you will.
By Roy Brown
I used OpenCOBOL to port two HP 3000 COBOL programs — only two, but one of them was the big and critical engine at the heart of a system otherwise written completely in PowerHouse.
I first used the portability checker on COBOL II to make a few amendments to bring the program in line with the standards — and was able to roll that version back into the production HP3000 code at the time.
The thing that remained non-standard, but which OpenCOBOL supported, IIRC, was entry points. I could have got round the limitation of not having them, but I was pleased not to have to.
The one remaining issue after that was not having IMAGE on the new platform, but having to use Oracle instead. So I rewrote the IMAGE calls as Oracle PRO*COBOL calls. And I was quite surprised that this made the program shorter, or would have if I hadn't left the IMAGE calls in, but commented out, so I could refer back to them if there were issues.
So, armed with a readable program, I slotted it through the PRO*COBOL precompiler, which spits out unreadable COBOL, put that through the OpenCOBOL compiler, which spits out C (or did then, at any rate — does it still?) and then compiled that with the GNU C compiler.
All this was accomplished in a single makefile, so it was not hard to do.
The prospect of debugging any intermediate stage of this tottering house of cards was not inviting, but fortunately I didn't need to — all my mistakes were clearly visible in the PRO*COBOL source.
Once I got it working, which was a surprisingly smooth process, I handed it over, and left for my next assignment.
Checking back a year later, I was pleased to learn it had all just gone live, and the attentions of the finest Oracle optimisers known to man meant that the system was now up to 'only' twice as slow as the HP 3000 original. Despite running on unimaginably more powerful Intel hardware running RedHat Enterprise Linux 5.
Sometimes I think it would be easier to get back over the event horizon of a black hole than to get off an HP 3000, even "lift and shift," which this was. No wonder so many 3000s are still running, including the four I help look after — ones that should have been pensioned off, as indeed I should have been, years ago.