ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problems with negative decimal element in tds-message

Post new topic  Reply to topic
 Problems with negative decimal element in tds-message « View previous topic :: View next topic » 
Author Message
ARog
PostPosted: Tue Mar 14, 2006 9:29 am    Post subject: Problems with negative decimal element in tds-message Reply with quote

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
View user's profile Send private message
vk
PostPosted: Tue Mar 14, 2006 7:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
shanson
PostPosted: Wed Mar 15, 2006 6:05 am    Post subject: Reply with quote

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
View user's profile Send private message
ARog
PostPosted: Thu Mar 16, 2006 5:25 am    Post subject: Reply with quote

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
View user's profile Send private message
shanson
PostPosted: Thu Mar 16, 2006 6:43 am    Post subject: Reply with quote

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
View user's profile Send private message
vk
PostPosted: Thu Mar 16, 2006 6:59 am    Post subject: Reply with quote

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
View user's profile Send private message
shanson
PostPosted: Thu Mar 16, 2006 8:18 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problems with negative decimal element in tds-message
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.