|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Problems with negative decimal element in tds-message |
« View previous topic :: View next topic » |
Author |
Message
|
ARog |
Posted: Tue Mar 14, 2006 9:29 am Post subject: Problems with negative decimal element in tds-message |
|
|
Newbie
Joined: 14 Mar 2006 Posts: 4
|
Hi
we must read a TDS-message with positive and negative values. The values have leading spaces. If we process the message, a fault appears.
Data conversion failed: Data invalid. Type of the read data: string
If we deleted the leading spaces (only at the negative values), the message is processed properly but in production we cant deleted the spaces.
Example:
482; ;2006-01-30; 20000000,0000;2006-01-27;
482; ;2006-01-31; 20000000,0000;2006-01-27;
482; ;2006-02-01; 20000000,0000;2006-01-27;
482; ;2006-02-02; 20000000,0000;2006-01-27;
482; ;2006-02-03; 20000000,0000;2006-01-27;
482; ;2006-02-06; 20000000,0000;2006-01-27;
482; ;2006-02-07; 20000000,0000;2006-01-27;
482;2006-01-30; ; 0,0000;2006-01-27;
999; ;2006-01-30; -33000000,0000;2005-12-06;
999; ;2006-01-31; -33000000,0000;2005-12-06;
999; ;2006-02-01; -33000000,0000;2005-12-06;
999; ;2006-02-02; -33000000,0000;2005-12-06;
999; ;2006-02-03; -33000000,0000;2005-12-06;
999; ;2006-02-06; -33000000,0000;2005-12-06;
999; ;2006-02-07; -33000000,0000;2005-12-06;
999;2006-01-30; ; -33000000,0000;2005-12-06;
Can anybody help me??
Thanks
Achim |
|
Back to top |
|
 |
vk |
Posted: Tue Mar 14, 2006 7:35 pm Post subject: |
|
|
Partisan
Joined: 20 Sep 2005 Posts: 302 Location: Houston
|
Modify the message set and define the element as String. If you set the message set property Trim Both, then the leading and trailiing spaces will be removed. You can then do a CAST in ESQL to INTEGER or DECIMAL as required.
It is not possible to define the element as Interger or Decimal in the message set and make the parser accept values with spaces.
Regards,
VK. |
|
Back to top |
|
 |
shanson |
Posted: Wed Mar 15, 2006 6:05 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
If the space always appears, you can wrap the element in question in a group and model the space as a group indicator (GI).
Create a local group that contains just the element. Set the GI of the group to be a space. Set the Data Element Separation to be All Elements Delimited. Set Delimiter to be anything you like (delimiters are infix, so never appear in a group containing just one element).
This way you can model the element as a decimal. |
|
Back to top |
|
 |
ARog |
Posted: Thu Mar 16, 2006 5:25 am Post subject: |
|
|
Newbie
Joined: 14 Mar 2006 Posts: 4
|
Hi,
thanks for your answers. Our solution is:
- We have created two messagesets.
- With the first messageset we read the decimal field as string and trim the spaces. We can't cast into decimal since the decimal delimiter is a comma.
- We use the node ResetContentDescriptor with the second messageset. There it is defined that the decimal delimiter is a comma
Achim |
|
Back to top |
|
 |
shanson |
Posted: Thu Mar 16, 2006 6:43 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Re-parsing using another message set works but is very inefficient.
Some more info:
1) Trim Fixed Length String property only applies to fixed length data, so can't be used here. Which is annoying, because trimming white space from numbers is exactly what is designed to do!!
2) WMB V6 allows you to CAST from string to decimal using a pattern, and the pattern syntax allows you to specify that ',' is a decimal separator. |
|
Back to top |
|
 |
vk |
Posted: Thu Mar 16, 2006 6:59 am Post subject: |
|
|
Partisan
Joined: 20 Sep 2005 Posts: 302 Location: Houston
|
After you TRIM the string to remove spaces, you can use OVERLAY function to replace ',' with a '.'. Then you can do a CAST to DECIMAL.
Also, why do you need the second message set? Once you have CAST the incoming value to a DECIMAL, cant you use it for directly for mapping to the destination? Why do you need to reparse the message?
Are you in WMQI v2.1 or WBI MB?
Regards,
VK. |
|
Back to top |
|
 |
shanson |
Posted: Thu Mar 16, 2006 8:18 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Quote: |
you can wrap the element in question in a group and model the space as a group indicator (GI).
|
This is what you should really be doing. You only need one message set, and because you are modelling the data as a decimal, you can validate against min/max values if you desire. |
|
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
|
|
|
|