Extending The Life Of Legacy COBOL Apps

vek on 2001-11-13T13:24:05

It struck me the other day just how many different technologies we support at work. Perl plays a major role in gluing them all together.

We have some older legacy COBOL apps that are called from perl. There's an interesting mix, COBOL programs, running on Solaris, being called from perl. Works like a charm though and I'll get back to COBOL in a second.

Then there's the database dance. Along with COBOL ISAM files, we run (in no particular order of preference) Oracle, MySQL, mSQL, Sybase. Oracle, MySQL, and mSQL are all on Solaris. The Sybase database is on a remote NT box. Thanks to DBI, the DBD::* family and freetds perl talks happily away to all 4 relational databases - the perl->COBOL conversation does not require DBI.

So just when you think COBOL is dead and you're just supporting old projects - along comes a new project that requires some of that COBOL functionality. So, do you re-write the app or re-use it? You re-use it of course *grin*. But this is not your Grandad's COBOL app. In the true spirit of extending the life of a legacy app, this is an all singing, all dancing XML interface extravaganza.

We have XML server box that runs our initial perl XML servers. These servers accept socket connections from various clients both from our internal network and externally. The clients include perl apps, Java apps, Java GUI clients, VB GUI clients to name a few. XML 'messages' are sent over the socket connection and pre-parsed by the servers. From there, the XML message is routed to the applicable database box, one of which happens to be our COBOL database box. We also have perl XML servers running on the database boxes that do the real XML parsing. Let's stick with the COBOL box though. The data is extracted from the XML message, given to a COBOL program (which COBOL program depends on the type of XML message we've been sent), COBOL crunches the data and returns data back to the perl XML server. The perl XML server grabs a XML template, substitutes the placeholders with the response data from the COBOL program and sends the response XML message back to the originating client. This all happens faster than you and I can blink and the originating client has no idea it has just hit a ye olde COBOL program.

Pretty cool stuff.