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 » MB6 Exception Handling

Post new topic  Reply to topic
 MB6 Exception Handling « View previous topic :: View next topic » 
Author Message
deveshseena
PostPosted: Mon Sep 07, 2009 10:55 pm    Post subject: MB6 Exception Handling Reply with quote

Newbie

Joined: 07 May 2007
Posts: 7

Hi All,

Kindly any one please let me know why the below code doesn't work for decimal values (for the one highlightened in RED):

IF (decimal_to_convert IS NOT NUMBER) THEN
THROW USER EXCEPTION VALUES('U10001', 'decimal_to_convert in CAST_DEC_2_STR IS NOT NUMBER', decimal_to_convert, precision, scale);
END IF ;

me in resolving this issue for handling the decimal values of format 0.0
_________________
Devesh P
Bangalore
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Mon Sep 07, 2009 11:44 pm    Post subject: Re: MB6 Exception Handling Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

deveshseena wrote:


Kindly any one please let me know why the below code doesn't work for decimal values (for the one highlightened in RED):


Explain doesnt work? Throws an exception? Doesnt behave as you expect?

If you do a user trace it will show you line by line what it executes, including the outcome of "IF (decimal_to_convert IS NOT NUMBER)" which may help you determine why "its not working".
Back to top
View user's profile Send private message
deveshseena
PostPosted: Tue Sep 08, 2009 12:02 am    Post subject: Reply with quote

Newbie

Joined: 07 May 2007
Posts: 7

Trace provided me the output stating that 0.000 is not number. Hence to get more information about handling the exception, requesting to provide some solution for this.
_________________
Devesh P
Bangalore
Back to top
View user's profile Send private message
mgk
PostPosted: Tue Sep 08, 2009 1:29 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

I noticed a couple of things. Firstly you need to provide more information, namely the dayatype of 'decimal_to_convert' and exactly what information is returned, (post the relevant bits of the user debug trace).

Secondly I noticed that you have specifed a user defined SQLState ('U10001') in the exception that you throw, but it is in the wrong location if you want to catch this exception by its state in a user defined exception HANDLER. It needs to be the second insert as the first is defined to be the SQLCode like this:

THROW USER EXCEPTION VALUES( -1, 'U10001', 'decimal_to_convert in CAST_DEC_2_STR IS NOT NUMBER', decimal_to_convert, precision, scale);


Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
deveshseena
PostPosted: Tue Sep 08, 2009 9:16 pm    Post subject: Reply with quote

Newbie

Joined: 07 May 2007
Posts: 7

CAST ("InputRoot"."MRM".WNISRVR3_APP_DATA.WNISRVR3_SERVICE_APP_NUM[TEMP_APP_COUNT]."WN_LOC_SERVICE"[K]."WN_APRV_TOT_LC_AM" AS DECIMAL(12,3));

After the required statement is being executed the value returned is 0.000 and expected format is 000000000.000. The messages are getting failed after executing the exception handling statement stating that the value "0.000" is not a number.

If we remove the code, then we are able to get the successful response with the expected format.
_________________
Devesh P
Bangalore
Back to top
View user's profile Send private message
Luke
PostPosted: Wed Sep 09, 2009 12:49 am    Post subject: Reply with quote

Centurion

Joined: 10 Nov 2008
Posts: 128
Location: UK

deveshseena wrote:
the value returned is 0.000 and expected format is 000000000.000.


I think you are confused about the DECIMAL format. The 12,3 indicates precision and scale. Just because precision is 12, doesn't mean it will include meaningless digits (e.g. leading zeros) in the representation of a number. If you want to format something to explicitly display it in a certain format, you need to cast it to a STRING, explicitly stating the format using a pattern.
Back to top
View user's profile Send private message
Luke
PostPosted: Wed Sep 09, 2009 1:15 am    Post subject: Re: MB6 Exception Handling Reply with quote

Centurion

Joined: 10 Nov 2008
Posts: 128
Location: UK

deveshseena wrote:

IF (decimal_to_convert IS NOT NUMBER) THEN


Also, what do you think this statement is doing? I'm not familiar with this particular syntax, please can you explain it?

Thanks
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 » MB6 Exception Handling
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.