|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Creating a message set for a CSV file |
« View previous topic :: View next topic » |
Author |
Message
|
javaforvivek |
Posted: Wed Jul 14, 2004 4:12 am Post subject: Creating a message set for a CSV file |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
Hi,
Can anybody guide me step by step how to create a message set for a message read from CSV file?
for e.g.,
The CSV File contains following data.
10000,FirstName1,LastName1 (there is new line feed here)
20000,FirstName2,LastName2
The MQ Message will contain the same data... _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
kirani |
Posted: Wed Jul 14, 2004 9:23 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
You can either model your message using TDS or CWF format. However, it'd make more sense to use TDS wire format.
When modeling message in TDS format, you need to set Data Element Separation property for your Type element to All Elements Delimited and set the [i]Delimiter[/b] property to ,. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
javaforvivek |
Posted: Thu Jul 15, 2004 12:36 am Post subject: CSV to XML Conversion |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
Hi Kiran,
Thanks for the advice.
I am using WBIMB5+CSD03
What I have done is:
1. Created a Message Set with TDS format. Name of the format is TDS1. In Physical Properties : Messaging Standard - unknown. Rest of the properties left as they are.
2. Created a Message Def File.
3. Added Global elements ID, FirstName, LastName.
4. Then created a Complex Type 'Line'. In Physical Properties, 'Data Elements Separation' is set to 'Variable Length Elements Delimited'. And 'Delimiter' is set to ,.
5. Now I added the Global Element References of ID, FirstName, and LastName to this type 'Line'.
6. I created another Global element 'Line' of type 'Line'.
7. I created another Complex Type 'Loop'. I want this type to indicate the looping through the CSV Message (Because my CSV Message is multi-line)
In Physical Properties of 'Loop' type, I set 'Data Element Separator' property to 'Variable Length Elements Delimited' and 'Delimiter' is set to '<CR><LF>'.
8. I created a Global Element 'File' of Type 'Loop'.
9. Then I added Global Element Reference for 'Line' to 'File' element and Set MaxOccurs property to -1 (for, my file may contain indefinite lines and each line will contain CSV data).
10. Now I added Message File from Global Element Reference.
Now I created a sample file with following data:
10000,V,P
20000,R,J
Here, each line is separated by New Line Character (in Java we use '\n' for this!!). And each element within the line is separaeted by Comma.
I used RFHUtil tool to read the file and put the message on the input queue.When I tested the message flow in Debug Perspective, the Message Tree Shows as follows:
Message
+Properties
+MQMD
+MRM
+Line
-ID = 10000
-FirstName = V
- LastName = P(new line characters)20000,R,J
Where I had gone wrong in defining the message and message set??
Please suggest the corrections. _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
shanson |
Posted: Fri Jul 16, 2004 5:55 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Try this:
- Remove your 'Loop' element and type
- Make your 'File' type contain one child - 'Line'
- Give your 'File' type a separation of 'All Element Delimited', any delimiter you choose as it will never appear (except <CR><LF>)
- Make your 'Line' repeat (maxOccurs -1) and give it a repeating element delimiter of <CR><LF>. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|