Can OpenLegacy help connect PHP with DB2 on the mainframe?

Recently, a poster to a mainframe technical discussion forum asked the question: How can we connect PHP (a popular server-side scripting language designed for web development) with DB2 on the mainframe? Treehouse Senior Software Developer Frank Griffin replied, describing how OpenLegacy could be the answer.  

You have some options here. If all you want is access to the raw DB2 data, JDBC or ODBC access will work fine for you, although you will have to write either C ODBC or Java JDBC code that can be called from PHP to do the deed.

If you already have mainframe code accessible via the network (CICS/IMSDC/TSO via TN3270, CICS via TCP/IP) that accesses your data and adds business logic to the mix, you can use the FOSS* OpenLegacy project to mate this logic to your PHP app.

The simplest approach involves using OL to navigate through the green screens of (CICS, IMS/DC, TSO, or whatever) to get to the data you want. This is done via the OSS** s3270 scripting 3270 emulator which creates an XML “trail” file which documents the interactions between yourself and the legacy application over the TN3270 connection. Once you’ve navigated through the series of screens that exposes the data you want to find, you trigger a portion of OpenLegacy which analyzes those screens, identifies logon sequences and unprotected fields on those screens which are linked to client-supplied input data, and generates Java classes which can at some later time use the “trail” file to re-drive the emulator to access the legacy application using client-supplied values for some of the input in order to obtain transaction output associated with those input values.

If your mainframe apps are better modularized, i. e. if you have separated the business logic from the display logic, and the business logic can be invoked through a CICS COBOL program which is designed to obtain its input and provide its output via a CICS COMMAREA, OL can analyze the source code and generate Java classes that invoke those programs directly without screen-scraping.

And, if what you really want is JDBC, OL can generate a series of Java classes that do all of the JDBC work for you and provide you with methods that simply provide the legacy data with no hint as to where it came from.

OL can also layer additional access software. Once the fundamental Java classes that access the legacy data are in place, OL can generate Java apps that use those classes on behalf of clients using all sorts of modern APIs, including SOA/SOAP, REST/JSON, and Mobile. All of this happens with the push of a button.

All of this is FOSS. You can download the OL code and start using it immediately, and it can do all that I’ve described, out-of-the-box. OL makes their money from selling an Enterprise Edition that includes support and some security and management pretties.

If the only access path from PHP to Java is direct invocation of Java code, you’d have to write a Java stub to interact with the OL classes, but this s going to be a *lot* simpler than trying to write JDBC or ODBC applications on your own.

*FOSS = Free Open-Source Software

**OSS = Open-Source Software


__OpenLegacy_Logo

OpenLegacy is the world’s first and only light-weight, non-intrusive solution for automated legacy modernization and enterprise application integration. With its standards-based, open-source platform, OpenLegacy enables enterprises to rapidly extend legacy systems to mobile, web and cloud applications; delivering risk-free, high-impact results that solve immediate business needs.

__OpenLegacy_High_Level

OpenLegacy‘s standard tools rapidly extract the services and information from within legacy systems into an editable format that puts the power of integration into the enterprises’ hands without the expensive handcuffs of vendor lock in. Once a business process is exposed — which can be done in minutes — the output can automatically be transformed into stand-alone mobile, web, and cloud applications; and connected with other solutions. Most importantly, no changes are required to the legacy system in order for OpenLegacy to work — the process is risk-free.

Contact Treehouse today for more information!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s