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 » [solved] using RESIGNAL aftr checkin Number in ExceptionList

Post new topic  Reply to topic
 [solved] using RESIGNAL aftr checkin Number in ExceptionList « View previous topic :: View next topic » 
Author Message
j.f.sorge
PostPosted: Fri Dec 18, 2009 2:34 am    Post subject: [solved] using RESIGNAL aftr checkin Number in ExceptionList Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

Hello!

I have a default code snippet which parses the ExceptionList and returns the Number. The returned value is checked against 3151 which should cause the flow to retry the action. Any different error should be thrown again using RESIGNAL but no Exception will be thrown at this point and the flow completes as there was no Exception.
Code:
CREATE COMPUTE MODULE HTTP_SOAP_Request_SF_checkForTimeout
   
   DECLARE extCheckForTimeout   EXTERNAL BOOLEAN;
   
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      CALL CopyEntireExceptionList();
      
      IF extCheckForTimeout THEN
         DECLARE intErrorNumber   INTEGER parseExceptionList(InputExceptionList.*[1], Environment);
         --do a ShortRetry if TimeOut has occured
         IF intErrorNumber=3151 THEN
            CALL createSFLFehlerText(Environment, intErrorNumber);
            --will cause a UserException to be thrown
            CALL ThrowShortRetrySetFehlerNr(Const_getErrorNumberWebServiceErrorTimeout(), Environment);
         ELSE
            RESIGNAL;
         END IF;
      ELSE
         RESIGNAL;
      END IF;
   END;
   
   CREATE PROCEDURE CopyEntireExceptionList()
   BEGIN
      SET OutputExceptionList   = InputExceptionList;
   END;
END MODULE;


User Trace of the code above prints the following
Code:
2009-12-18 11:09:00.998273     5960   UserTrace   BIP2539I: Knoten 'test.templates.UEMB_PF0C000_TestHttpSoapRequest_MF.HTTP_SOAP_Request_SF_ProxyTimeout.checkForTimeout': Ausdruck ''intErrorNumber = Const_getExNumSocketTimeout()'' in ('std.templates.HTTP_SOAP_Request_SF_checkForTimeout.Main', '8.21') wird ausgewertet. Ausdruck wurde in ''3150 = 3151'' aufgelöst. Das Ergebnis war ''FALSE''.
2009-12-18 11:09:00.998287     5960   UserTrace   BIP2537I: Knoten 'test.templates.UEMB_PF0C000_TestHttpSoapRequest_MF.HTTP_SOAP_Request_SF_ProxyTimeout.checkForTimeout': Anweisung ''RESIGNAL;'' in ('std.templates.HTTP_SOAP_Request_SF_checkForTimeout.Main', '12.5') wird ausgeführt.
2009-12-18 11:09:00.998314     5960   UserTrace   BIP4007I: Die Nachricht wurde an das Ausgangsterminal des Knotens 'test.templates.UEMB_PF0C000_TestHttpSoapRequest_MF.HTTP_SOAP_Request_SF_ProxyTimeout.checkForTimeout' weitergeleitet.


Any suggestions why there is no Exception anymore?
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0


Last edited by j.f.sorge on Fri Jan 08, 2010 1:32 am; edited 1 time in total
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Dec 18, 2009 3:50 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

As it says in the RESIGNAL docs:

"You can use RESIGNAL only in error handlers"

You are not in an error handler here...
_________________
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
j.f.sorge
PostPosted: Fri Dec 18, 2009 5:12 am    Post subject: Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

mgk wrote:
As it says in the RESIGNAL docs:

"You can use RESIGNAL only in error handlers"

You are not in an error handler here...

Do I have to use the CREATE ... HANDLER statement to declare an error handler? How can I than check the Exception which the Node before has thrown?
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Dec 18, 2009 7:23 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
Do I have to use the CREATE ... HANDLER statement to declare an error handler


Yes

Quote:
How can I than check the Exception which the Node before has thrown?


The simple answer to your original question is you can't in the way you are doing it as it actually depends on how you design your flow. If you wire up the failure terminal of a node, then you get an ExceptionList with the message sent to that terminal and then you cannot rethrow that same exception (but you can throw a new one). However, if you do not wire up the failure terminal, and let the exception go back up the flow to a compute node which PROPAGATEd inside a HANDLER then you can look at the SQLCODE, SQLSTATE, SQLERRORTEXT and SQLNATIVERROR (but no exception list) to determine the error's cause and LOG or whatever then you can use the RESIGNAL statement to rethrow the exception.

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
j.f.sorge
PostPosted: Thu Jan 07, 2010 12:42 am    Post subject: Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

mgk wrote:
The simple answer to your original question is you can't in the way you are doing it as it actually depends on how you design your flow. If you wire up the failure terminal of a node, then you get an ExceptionList with the message sent to that terminal and then you cannot rethrow that same exception (but you can throw a new one). However, if you do not wire up the failure terminal, and let the exception go back up the flow to a compute node which PROPAGATEd inside a HANDLER then you can look at the SQLCODE, SQLSTATE, SQLERRORTEXT and SQLNATIVERROR (but no exception list) to determine the error's cause and LOG or whatever then you can use the RESIGNAL statement to rethrow the exception.

Regards,

When using a HANDLER to be able to rethrow the original Exception where is the BIP number of the Exception stored? Can I get the value by using SQLSTATE?
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Jan 07, 2010 1:19 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

By unchecking the box on the Compute Node options, you can check SQLState in your ESQL without throwing an exception.

There are cases where this is useful but I tend to do it every time because I can then control things a bit more.
For example, I can store information in the Environment Folder that relates to the actual operation being performed. This is especially useful if you are doing more than one DB operation in one bit of ESQL. You can also include a copy of the SQL command that you issued.

This will all help with problem resolution in the long run.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
j.f.sorge
PostPosted: Thu Jan 07, 2010 4:27 am    Post subject: Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

smdavies99 wrote:
By unchecking the box on the Compute Node options, you can check SQLState in your ESQL without throwing an exception.
...

I don't want to do any check for DB Exception but a check for a specific Exception (Number) which occurs when a WebService Requests gets a timeout. This error should cause the flow to retry without writing any error message. That is why I asked where I can get the value of Exception Number in HANDLER.
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Jan 07, 2010 5:21 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
That is why I asked where I can get the value of Exception Number in HANDLER.


The simply answer is you can't. In a handler, you work with SQLSTATEs which the SQLSTATE function returns. If you lookup the SQLSTATE function you will see a list of valid SQLSTATEs that use can detect (or you can create your own for user generated exceptions). You only get a BIP message number in an exception list, and there is no exception lists in a handler. However, in a HANDLER, if you use RESIGNAL then the original exception is rethrown, and if uncaught, will end up producing an exceptionlist in any node that has a catch terminal wired (or a in a catch node).
_________________
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
j.f.sorge
PostPosted: Fri Jan 08, 2010 1:23 am    Post subject: Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

mgk wrote:
Quote:
That is why I asked where I can get the value of Exception Number in HANDLER.


The simply answer is you can't. In a handler, you work with SQLSTATEs which the SQLSTATE function returns. If you lookup the SQLSTATE function you will see a list of valid SQLSTATEs that use can detect (or you can create your own for user generated exceptions). You only get a BIP message number in an exception list, and there is no exception lists in a handler. However, in a HANDLER, if you use RESIGNAL then the original exception is rethrown, and if uncaught, will end up producing an exceptionlist in any node that has a catch terminal wired (or a in a catch node).

I solved the problem by wiring the Failure terminal, get the Number of the Exception by parsing the ExceptionList (with storing the Inserts, too) and throw a new Exception with the Number I got before.
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
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 » [solved] using RESIGNAL aftr checkin Number in ExceptionList
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.