|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
modelling CSV file using DFDL in WMB V8 |
« View previous topic :: View next topic » |
Author |
Message
|
MQEnthu |
Posted: Thu Jun 28, 2012 1:55 am Post subject: modelling CSV file using DFDL in WMB V8 |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
I have modeled a CSV message using DFDL parser in WMB V8. The message looks as:
"000010","CHRISTINE","I","HAAS","A00","3978","1995-01-01","PRES ",18,"F","1963-08-24",152750.00
I have modeled the DFDL having one complex type with 12 fields in it and , as delimiter. I did run the DFDL test with the above message and it did parse the message successfully. And with prase result, I tried serialising it using DFDL Test - Serialize. But message generated after serializing is not same as above message; "" around the strings values got omitted.
File generated after serialization:
000010,CHRISTINE,I,HAAS,A00,3978,1995-01-01,PRES ,18,F,1963-08-24,152750
I checked the logical tree when I did DFDL Test - Parse, the string fields did not contain the "" as part of data. For ex. the second field data was shown as CHRISTINE.
Since "" are NOT configured as any seperators/delimiters, I think they should be part of the data. But the behaviour I see is different.
Am I missing something?? Any comments why it is behaving like this? Please help.  _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 28, 2012 3:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
They're probably handled as part of the default schema you're also using, that made it so easy to create this simple model. |
|
Back to top |
|
 |
MQEnthu |
Posted: Thu Jun 28, 2012 3:31 am Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
No, I checked that. I do not see that property set any where in message. However if it was set when I do serialization using same message DFDL, it should appear in the serialized message. That is not happening.. _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 28, 2012 4:26 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Since "" are NOT configured as any seperators/delimiters, I think they should be part of the data. But the behaviour I see is different. |
Nearly right. The quote characters are not delimiters, and they are not data either. They are 'escape characters' and they are defined as part of the 'escape scheme' for your DFDL model.
An escape scheme is a mechanism for handling data that might contain delimiters. On the Unix command line, the character of '\' is used as an escape character. It 'escapes' the next character and causes it to be treated literally. In CSV messages, the escaping mechanism is different. Fields can be enclosed in quote characters. The quote characters are not part of the data, but any commas or line feeds between the quote characters are treated as part of the data.
DFDL allows you to control how escaping is applied when writing. You can choose from
a) only add escape characters when the field contains delimiters
b) always add escape characters
You want b). So now you want to know how to modify your model using the DFDL editor...
- Click the 'Show advanced' button
- Select any text field
- Under the 'Text Content' section, find the 'Escape Scheme ref' property
- Move the mouse over the property value and wait for the information box to pop up
- Select the entry that says 'Property references global named format'
You should now be looking at the default escape scheme that is defined in IBMCommaSeparatedFormat.xsd. The 'Generate Escape Block' property is the last property - set it to 'always'.
- Re-test, and report back with the results  |
|
Back to top |
|
 |
MQEnthu |
Posted: Fri Jun 29, 2012 1:16 am Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
Thank you Kimbert for a detailed explination...
I will surely test this and report the results here... _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
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
|
|
|
|