Problem solve Get help with specific problems with your technologies, process and projects.

Can a COBOL program running on z/OS read an MS SQL server database?

I have been asked whether a COBOL program running on z/OS can read a Miscrosft SQL server database. I am assuming the question refers to both batch and CICS COBOL programs.

My first two thoughts were some sort of DRDA connection via DB2 or a socket application of some sort, possibly involving XML. Basically, I haven't a clue! Can you give me a quick rundown on the possibilities?

The environment we're talking about is a z/OS 1.3 system with TS 1.3 (soon to be 2.2) and DB2 V7 potentially talking to SQL server running on Windows 2000. We also have WebSphere on the Windows 2000 platform if that would help.

Thanks for any insight you can give me.

Well, the first thing to say is that I'll come clean and admit to not knowing too much about this topic myself. I've also had a wander around my chums here at Hursley and have not been enlightened to any great degree.

The first thing to observe is that database access from CICS MUST proceed via a TRUE -- this TRUE running the connection to the database server. CICS ships a TRUE for DB2 and other vendors (like, I think Adabase or Oracle and there may be others) provide a TRUE so that these databases can be accessed from CICS.

I had a look at the Microsoft Web site and could not find any mention of an attachment facility from CICS and no one I've talked to thinks it exists. We might, of course, be wrong!

So, even using a technology like JDBC v2.0 to run the database access requires this layer and, as it is not around, that rules out JDBC access.

I also had a talk with the CICS DB2 experts and they don't think that host DB2 can contact a SQL Server so the option of routing traffic from CICS via DB2 does not seem to be a doable.

Therefore, I don't think that a direct access to SQL server sourced info is doable from CICS.

There is the possibility of the EJB route but I did not find any standard references to that on the SQL server Web site. Nevertheless, I think it might well be the case that you can create an EJB that runs in a JVM on the same machine as the SQL server and this EJB issues the relevant SQL calls to the Microsoft SQL server. This could be transactional (for the JVM in CICS to the EJB in the local box to the SQL server access) so that fits in the CICS model. This boils down into an application programming design to pass the parameters into the EJB, and get the results back from the EJB.

An equivalent arrangement would be to have a CICS/Windows running on the same box as the SQL server and use an XC LINK SYSID(tothisbox) COMMAREA() from BigCICS. Whereat this linkedto program would issue the relevant APIs to access the SQL Server.

However, I did find a reference of the Microsoft SQL site about access technologies for SQL server. I noticed that it supports ADO, OLE, DAO ESQL, T-SQL and XML (again, there may be others that I've not noticed).

The interesting thing about this list is XML. If you are on CTS 2.2, you can use the new SOAP SupportPac to issue XML requests from CICS.

Consequently, you might be able to frame the SQL Server request in an XML/SOAPy format and send this directly to the SQL Server via TCP/IP for execution.

And that, I'm afraid, reaches the limit of my advice on this topic. I suggest you initially investigate the XML route as this appears to give a platform-independent way of accessing SQL server-based information. Time to hit the Microsoft Web site and the SQL server documentation!

Robert Harris
CICS Technical Strategist -- CICS expert at Search390.com

Editor's note: Do you agree with this expert's response? If you have more to share, post it in one of our .VO7aaqqaAFk.0@/search390>discussion forums.

Dig Deeper on IBM system z and mainframe systems

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.