Ok, the readers who are not from the mainframe world may wonder what “CICS” means. According to IBM’s official web site, CICS is defined as follows: “CICS (Customer Information Control System) is a family of application servers and connectors that provides industrial-strength, online transaction management and connectivity for mission-critical applications.” There you have it.

So, CICS is a transaction server (plus tools and extensions) that runs on IBM mainframes on the z/OS and z/VSE operating systems. It is commonly used for high-volume online transaction processing applications. CICS applications are typically written in COBOL, PL/1, or C.

CICS Version 3.1 has introduced support for web services and SOAP, which enables CICS applications to be web service providers or web service consumers (requester). The transport mechanism used is typically HTTP or MQ message queues, and the web service messages are (almost always) in XML format.

Applications that use web services, e.g. in service-oriented architectures, often have the need to store incoming and/or outgoing messages in a database. Sometimes this is needed for compliance reasons or simply to have a “log” of the information that is being exchanged. This log can be indexed and queried efficiently.

Since the web service message are in XML and their content and structure may vary, storing them in their original XML format is a natural choice and a very common use case for the XML databases, including DB2 pureXML.

With the pureXML support in DB2 9 for z/OS it becomes straight forward to combine CICS web services with XML management in DB2. For example, XML messages of varying format can be stored in the same XML column, exploiting the support for schema variability in DB2. Here are some examples of what you can do:

Receive and store web service messages in a CICS application (in-bound):

  • Store incoming SOAP messages as-is in an XML column in a DB2 table
  • Extract the payload from incoming SOAP messages and insert this payload into an XML column
  • Shred the payload of an incoming SOAP message to a set of relational tables, using SQL/XML

Produce and sent web service messages in a CICS application (out-bound):

  • Retrieve an XML document from an XML column in a DB2 table and send it out
  • Extract pieces from one or multiple XML documents in an XML column and combine them to an outbound message
  • Retrieve an XML document from an XML column and modify it with XQuery update expressions before sending it out (DB2 10 for z/OS)
  • Constructing outbound XML messages from traditional relational data, using SQL/XML functions (DB2 V8 for z/OS and higher)

All of the XML-related processing such as extracting, shredding, modifying, or constructing XML can be accomplished by DB2 pureXML features that can be invoked from the CICS application.

If you want to know how to put it all together, I’ll refer you to two articles written by people who know a lot more about CICS than I do:

Using CICS with DB2 pureXML, Part 1: Perform basic XML storage and retrieval through CICS Web services

Using CICS with DB2 pureXML, Part 2: Perform advanced XML storage and retrieval through CICS Web services

These articles describe how to implement most of the scenarios that I have listed above.

“Extremely pureXML in DB2 10 for z/OS”, that’s the title of a brand-new IBM Redbook that got released just a couple of weeks ago. This book describes the pureXML features in DB2 9 for z/OS and DB2 10 for z/OS based on an application scenario that runs through all chapters of the book. The application scenario is about receiving and processing bank-to-customer statements that follow the UNIFI (ISO20022) standard XML format.

The book shows how to obtain such UNIFI messages from a Websphere MQ message queue and how to persist and manipulate them with SQL/XML stored procedures or through Java or COBOL applications. Detailed code samples in Java and COBOL illustrate how you can query and process the XML messages and exploit the pureXML capabilities in DB2 for z/OS.

Additionally, database administrators will find chapters 9 and 10 useful, which provide coverage of XML-related admin task and describe how DB2 z/OS utilities work with XML data.

The outline of the book is as follows:

Chapter 1. Introduction
Chapter 2. XML and DB2 for z/OS
Chapter 3. Application scenario
Chapter 4. Creating and adding XML data
Chapter 5. Validating XML data
Chapter 6. DB2 SQL/XML programming
Chapter 7. Using XML with Java
Chapter 8. Using XML with COBOL
Chapter 9. Utilities with XML
Chapter 10. XML-related tasks for the DBA
Chapter 11. Performance considerations
Appendix A. Application scenario documents
Appendix B. Additional material

You also find coverage of some of the new XML features in DB2 10 for z/OS, such as binary XML data flow for JDBC applications, node-level XML Updates, and XML manipulation in user-defined functions and stored procedures.

Although the book provides brief introductions to XML, XPath, XQuery, SQL/XML, etc., the book is less focused on providing comprehensive tutorials for these core technologies and much more focused on illustrating their integration with each other in the context of DB2 for z/OS applications and databases. The book also touches on several advanced topics, such as handling incoming XML messages through Change Data Capture (CDC) and multi-version concurrency control for XML.

The Redbook “Extremely pureXML in DB2 10 for z/OS” is available for online reading and as a PDF at http://www.redbooks.ibm.com/redpieces/abstracts/sg247915.html?Open.

Other material on XML DB2 for z/OS that you may find useful include:

Happy reading !

Extremely pureXML in DB2 10 for z/OS