Skip to content

XML to COBOL Mapping in IBM Integration Bus

by on June 18, 2015

We have made a new video of our XML to COBOL examples that we have done in WebSphere Message Broker v7 and V8.   If you follow this video example end to end you will be able to get a XML to COBOL integration solution working quickly.   We are also including the XML Schema and COBOL copybooks at the end of this blog post.

 

 

Thank you for checking out our blog post and video.   Please let us know if you have any questions or feedback.

Thank you,

TransformaTech, Inc

Follow us on Twitter at:  TransformaTech Twitter

XML TO COBOL Artifacts:

1. XML Schema

<?xml version=”1.0″ encoding=”UTF-8″?><xsd:schema xmlns=”” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”&gt;
<xsd:element name=”SampleInput”>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref=”Name”/>
<xsd:element ref=”Address”/>
<xsd:element ref=”Contact”/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name=”Name”>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref=”FirstName”/>
<xsd:element ref=”LastName”/>
<xsd:element ref=”MiddleInitial”/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name=”Address”>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref=”Street”/>
<xsd:element ref=”City”/>
<xsd:element ref=”State”/>
<xsd:element ref=”ZipCode”/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name=”Contact”>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref=”Phone”/>
<xsd:element ref=”Email”/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name=”FirstName” type=”xsd:string”/>
<xsd:element name=”LastName” type=”xsd:string”/>
<xsd:element name=”MiddleInitial” type=”xsd:string”/>
<xsd:element name=”Street” type=”xsd:string”/>
<xsd:element name=”City” type=”xsd:string”/>
<xsd:element name=”State” type=”xsd:string”/>
<xsd:element name=”ZipCode” type=”xsd:string”/>
<xsd:element name=”Phone” type=”xsd:string”/>
<xsd:element name=”Email” type=”xsd:string”/>
</xsd:schema>

2.  XML COBOL Copybook (IMPORTANT NOTE:  spacing and formatting is important when using copybook inside IIB for import.   It is important when you copy and paste these into a file that there are no tabs and everything is positioned correct)

01 SAMPLEOUTPUT.
03 NAME.
05 FIRSTNAME                                    PIC X(20).
05 LASTNAME                                     PIC X(25).
05 MIDDLEINITIAL                                PIC X(1).
03 MYADDRESS.
05 MYADDRESS1                                   PIC X(40).
05 CITY                                         PIC X(25).
05 STATE                                        PIC X(2).
05 ZIP                                          PIC X(5).
03 CONTACT.
05 PHONE                                        PIC X(10).
05 EMAIL                                        PIC X(50).
03  FILLER                           PIC X(1000) VALUE SPACES.

3.  Sample Input Message

<SampleInput>
<Name>
<FirstName>Info</FirstName>
<LastName>TransformaTech</LastName>
<MiddleInitial>M</MiddleInitial>
</Name>
<Address>
<Street>1 E Uwchlan Ave</Street>
<City>Exton</City>
<State>PA</State>
<ZipCode>19341</ZipCode>
</Address>
<Contact>
<Phone>5555555555</Phone>
<Email>info@transformatech.com</Email>
</Contact>
</SampleInput>

Advertisements

From → Integration

3 Comments
  1. Brian permalink

    Is there a way to do the opposite, taking the cobol copybook and converting it to XML?

    • Hi Brian – Yes, this can be done in reverse the exact same way. Many of our client implementations of this involve the following Scenario:

      1. Web Application (.NET, J2EE, etc) sends XML request to IIB/WMB
      2. IIB/WMB transforms message to fixed length message and optionally adds IMS/CICS header for IMS/CICS transactions and sends to queue on mainframe
      3. IMS/CICS Bridge (or COBOL program) receives message from this queue performs logic and sends fixed length message to a reply queue to send to IIB/WMB
      4. IIB/WMB takes this response, transforms it back to XML and sends back to Web Application.

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

%d bloggers like this: