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] handler never entered

Post new topic  Reply to topic
 [Solved] handler never entered « View previous topic :: View next topic » 
Author Message
Esa
PostPosted: Tue Jan 17, 2012 7:01 am    Post subject: [Solved] handler never entered Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

I have written a little ESQL function:

Code:

   CREATE FUNCTION Traverse(IN inRef REFERENCE, IN outRef REFERENCE) RETURNS BOOLEAN
   BEGIN
      SET Environment.start='start';
      BEGIN
         DECLARE EXIT HANDLER FOR SQLSTATE LIKE '%'
         BEGIN
            DECLARE state CHARACTER SQLSTATE;
            SET Environment.handler = 'handler';
            -- do something
            WHILE some_condition DO
               IF Traverse(inRef, outRef) THEN
                  -- do something
               ELSE
                  RETURN FALSE;
               END IF;
            END WHILE;
            RETURN TRUE;
         END;
      END;
      SET Environment.end = 'end';
      RETURN FALSE;
   END;   


When I run/debug the flow, the handler code is never entered.

Is it because the compiler has prevented using a handler recursively or have I done something wrong?

Broker version 6.1.0.5, tested on AIX


Last edited by Esa on Tue Jan 17, 2012 8:37 am; edited 1 time in total
Back to top
View user's profile Send private message
mgk
PostPosted: Tue Jan 17, 2012 7:27 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Well this code is the body of the HANDLER:

Code:
DECLARE EXIT HANDLER FOR SQLSTATE LIKE '%'
         BEGIN
            DECLARE state CHARACTER SQLSTATE;
            SET Environment.handler = 'handler';
            -- do something
            WHILE some_condition DO
               IF Traverse(inRef, outRef) THEN
                  -- do something
               ELSE
                  RETURN FALSE;
               END IF;
            END WHILE;
            RETURN TRUE;
         END;


And I see no code that could cause an exception that would cause the exception handler block to be entered.

Kind 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
Esa
PostPosted: Tue Jan 17, 2012 7:29 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

Thanks,

Yes, I was putting the try code in the catch block.
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] handler never entered
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.