Creating and testing message models for C and COBOL in IBM Integration Bus

This article shows you how to use the new Data Format Description Language (DFDL) support in IBM integration Bus to model, create, run, and test messages in C and COBOL.

Bhavya R Krishnapura (bhavkris@in.ibm.com), Staff Software Engineer, WebSphere MQ Development Team, IBM

Photo of Bhavya R KrishnapuraBhavya R Krishnapura is a Staff Software Engineer on the WebSphere MQ Development Team in India. She is a graduate of the Sri Jayachamarajendra College of Engineering (SJCE) in Mysore, India, and has been working for IBM for five years. You can contact Bhavya at bhavkris@in.ibm.com.



Geetha Rh Murthy (gemurthy@in.ibm.com), Software Tester, Business Analytics Test Team, IBM

Photo of Geetha Rh MurthyGeetha Rh Murthy is a Software Tester on the Business Analytics Test Team at the IBM Software Lab in Bangalore, India. She has five years of testing experience with the WebSphere Message Broker and WebSphere MQ Test Teams, and she has a Bachelor's degree in Electronics and Communications Engineering. You can contact Geetha at gemurthy@in.ibm.com.



13 November 2013

Introduction

Message models are used by IBM® Integration Bus to model various message formats, including non-XML formats. The message models used by IBM Integration Bus are based on World Wide Web Consortium (W3C) XML Schema 1.0 (XSD). This article shows you how to create DFDL message models and use them to execute and test messages in message formats used in C and COBOL applications.

DFDL is an XML-based language used to define the structure of formatted data independently from the data format itself. A DFDL parser is used to read and write messages in the DFDL domain. When reading a message, the DFDL parser interprets a bit stream by using grammar defined in a DFDL schema file, and generates a corresponding DFDL domain logical message tree in the broker. When writing a message, the DFDL serializer generates a DFDL formatted bit stream from a DFDL domain logical message tree:

Figure 1
Figure 1

You can use a DFDL schema to model various data formats, including:

  • Comma separated value (CSV)
  • Record-oriented
  • Custom text or binary
  • COBOL data structures
  • C header files

This article shows you how to test DFDL schemas for various data formats, such as C header files and COBOL data structures, using the IBM Integration Bus Toolkit without using the runtime broker. This article covers the following tasks:

  • Creating C and COBOL message models using the new IBM Integration Bus Message Model Wizard
  • Creating DFDL schema files for C header files and COBOL data structures
  • Testing C and COBOL message models by passing the appropriate data to each of the message models

The article will use this C structure for illustration:

struct customer_details
{
   char customer_id;
   char first_name[7];
   char last_name[12];
   char dob[11];
   char address[25];
   };

Creating a DFDL C message model

  1. Create a library named CMsgModelLib, right click-on it, and select New => Message Model:
    Figure 2
  2. Select C and click Next:
    Figure 3
  3. Select the option to import the C header file and then Next:
    Figure 4
  4. Specify the path of the C header in the next window and then click Next.
  5. In the New DFDL Schema window, select the structure that you would like to import:
    Figure 6
  6. In the next window, specify the import properties or accept the default values, and then click Finish:
    Figure 8
  7. Here is the modeled C message:
    Figure 9

Testing a DFDL C message model

  1. In the C:\DFDLCData directory, create a text file named SampleStdata.txt with the contents shown below
    1 Bavani Ramachandra 25/11/1982 Jagadish Nagar Bangalore
  2. In IBM Integration Bus, you can immediately test and validate a DFDL message model with sample data. Click on Test Parse Model:
    Figure 10
  3. Provide the path of the sample C data file and click OK:
    Figure 11
  4. The sample CSV file was successfully parsed by the DFDL CSV parser:
    Figure 12

    Sample COBOL copybook:

        01 CUSTDET
            05 NAME       PIC X(12). 
            05 DOB        PIC X(10).
  5. Create a library named CobolMsgModel, right click-on it, and select New => Message Model:
    Figure 13
  6. Select COBOL and then click Next:
    Figure 14
  7. Select Create a DFDL schema file and then click Next:
    Figure 15
  8. Specify the path of the COBOL copybook and then click Next:
    Figure 16
  9. Select the structure you would like to import:
    Figure 17
  10. In the Import Options window, click Next, accept the default options, and then click Finish:
    Figure 18
  11. Here is the modeled COBOL message:
    Figure 20

Creating and testing a DFDL COBOL message model

  1. Create a sample COBOL data file with the contents shown below:
    John       20/01/1960        23123
  2. In an IBM Integration Bus DFDL message model, you can immediately test and validate a message model with the sample data. Click Test Parse Model:
    Figure 21
  3. Provide the path of the sample COBOL data file and then click OK:
    Figure 22

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=953614
ArticleTitle=Creating and testing message models for C and COBOL in IBM Integration Bus
publish-date=11132013