Running sample message CSV_2

This sample builds on sample message CSV_1 by including a header record in the CSV message. The input message contains a single header record followed by a single, repeating, comma separated record. Instead of converting the message from CSV to XML, the Compute node uses only the DFDL domain, and manipulates the logical message by using ESQL.

This topic includes instructions for running the sample. It also includes an example of an input test message and a corresponding expected output message, so you can confirm that the sample has worked.

For a more detailed explanation of the message model that is used in this sample, see Exploring the Comma Separated Value (CSV) sample.

If you encounter any problems when you run the sample, see Resolving problems when running samples in the WebSphere Message Broker documentation.

Test DFDL Schema CSV_2

You can test the sample input data against the DFDL schema file by using the Message Broker Toolkit.

To test the DFDL schema file:

  1. Open the DFDL schema file, CSV_2.xsd.
  2. Under Message Roots, right-click CSV_2. Click Test Parse Model.
  3. In the Test Parse Model window, select Content from a data file, click Browse.
  4. In the File Selection window, under the Message Broker Project, CSVSchemas, select the file CSV_2.csv. Click OK.

A window may be displayed that asks you if you want to open the DFDL Test perspective. Click Yes. The DFDL Test perspective opens, and the results of your test-parse are displayed in the DFDL Test - Parse view. If the test parse is successful, a message will appear that states, "Parsing completed successfully".

You can view the results of your test-parse in the Logical Instance view. The Logical Instance view displays data in a logical tree view. Use the parser log in the DFDL - Trace view to view any errors that occurred during parsing.

Input test message

The test message that is used in running this sample is based on the following format:

2011-11-11,X12334,customerdetails<CRLF>
Bob,Dyson,true,23,23456,0,1543543.36<CRLF>
Jimmy,Pace,false,1002,10001,-4.32423,654654.99<CRLF>
Ralf,McCartney,false,67,89125,4324307.35,986545.12<CRLF>
Elvis,John,true,3,60699,-0.343242356675,99999999999999.99<CRLF>
Rick,Clayton,true,461,33101,0.000000000000001,100.01

<CRLF> represents the characters with ASCII hex code points x'0D' and x'0A'.

Running the sample

This sample uses the CSV2CSV message flow. This message flow contains a single MQInput node attached to the queue CSV2CSV.IN1. The ESQL compute node modifies the balance field depending on whether the goldmember field is true. The output CSV message shows the physical structure of the message that was parsed, transformed in the mapping, and then serialized to the output queue.

To run the sample:

  1. In the Broker Development view, expand the Message Broker Project, CSVMessageFlows.
  2. Under Flow Tests, open CSVApplication.mbtest.
  3. In the Editor view, select the entry with the label "Invoke Message flow(CSV_2 to CSV_2 Balance adjusted for gold members)". Observe the CSV formated data.
  4. In the Editor view, click the Start icon.

The message flow parses the CSV message, modifies it, and serializes back to CSV. The output message is put to the CSV2CSV.OUT1 queue.

For an explanation of this message model, see Exploring the Comma Separated Value (CSV) sample.

Expected output message

The expected output message is:

2011-11-11,X12334,customerdetails
Bob,Dyson,true,23,"23,456",0,"1,929,429.2"
Jimmy,Pace,false,"1,002","10,001",-4.324,"654,654.99"
Ralf,McCartney,false,67,"89,125","4,324,307.5","986,545.12"
Elvis,John,true,3,"60,699",-0.343,"99,999,999,999,999.99"
Rick,Clayton,true,461,"33,101",0,100.01

Back to Running the sample

Back to sample home