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 » Exception Handler in ESQL - IMS Request

Post new topic  Reply to topic
 Exception Handler in ESQL - IMS Request « View previous topic :: View next topic » 
Author Message
mqbrks
PostPosted: Fri Jan 20, 2017 11:55 am    Post subject: Exception Handler in ESQL - IMS Request Reply with quote

Voyager

Joined: 17 Jan 2012
Posts: 75

Hi All,

I have a scenario where we need to process the records in a file. For each record a IMS request is to be sent and the ACKs are written back to file.

If the IMS request fails, a retry of 3 times is to be made. My logic is to write a handler in compute node. But the control doesn't come to the handler after propagate statement. Could someone please point what is wrong?

Code:
 DECLARE SUNRecordRef REFERENCE TO InputRoot.DFDL.GLBMGOSUN_IN_SUN.RECORD_IN_SUN[1];
            
          --  Continue processing for each item in the array
          WHILE LASTMOVE(SUNRecordRef) = TRUE DO
                
                 -- LL = lentgh of LL (2 bytes) + length of ZZ (2 bytes) + length of TransCode (8 bytes) + length of IMSData (first 10 chars of RECORD_IN_SUN)
                 SET OutputRoot.DFDL.IMSMessage.LL = 20;
               -- Resrved
                 SET OutputRoot.DFDL.IMSMessage.ZZ = '0';
                 SET OutputRoot.DFDL.IMSMessage.TRANCODE = SUBSTRING(SUNRecordRef FROM 11 FOR 8);
                SET OutputRoot.DFDL.IMSMessage.IMSDATA =  SUBSTRING(SUNRecordRef FROM 1 FOR 10);

                 SET totalProcessedCount =  totalProcessedCount + 1;
                 SET Environment.Variables.TotalProcessedCount = totalProcessedCount;    
                 SET Environment.Variables.TransCode = SUBSTRING(SUNRecordRef FROM 11 FOR 8);
                 SET Environment.Variables.SUN = SUBSTRING(SUNRecordRef FROM 1 FOR 10);
                
               PROPAGATE TO TERMINAL 'out';
               RETURN FALSE;
               
                 DECLARE retryCount INTEGER 0;
                                 
                 WHILE retryCount <=3 DO
                    DECLARE CONTINUE HANDLER FOR SQLSTATE LIKE '%'
                    BEGIN
                       ---If error occurs while propagating msg to IMS Server , retry for 3 times
                       SET retryCount = retryCount + 1;
                       
                        -- LL = lentgh of LL (2 bytes) + length of ZZ (2 bytes) + length of TransCode (8 bytes) + length of IMSData (first 10 chars of RECORD_IN_SUN)
                       SET OutputRoot.DFDL.IMSMessage.LL = 20;
                     -- Resrved
                       SET OutputRoot.DFDL.IMSMessage.ZZ = '0';
                       SET OutputRoot.DFDL.IMSMessage.TRANCODE = SUBSTRING(SUNRecordRef FROM 11 FOR 8);
                      SET OutputRoot.DFDL.IMSMessage.IMSDATA =  SUBSTRING(SUNRecordRef FROM 1 FOR 10);
                      PROPAGATE TO TERMINAL 'out';
                    END;
                 END WHILE;
                            
              -- Move the dynamic reference to the next item in the array
              MOVE SUNRecordRef NEXTSIBLING;
         END WHILE;   


Also is this logic good?? One of my friend says to have a subflow (for retry) after the IMS request and route back the request to the IN terminal of the IMS request node. I feel using handler reduces the number of nodes.

Your inputs are really appreciated.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jan 20, 2017 12:39 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

RETURN FALSE ends the compute node.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jan 20, 2017 12:40 pm    Post subject: Re: Exception Handler in ESQL - IMS Request Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mqbrks wrote:
But the control doesn't come to the handler after propagate statement. Could someone please point what is wrong?


Nothing - functioning as designed. The PROPOGATE statement sends a new copy of the tree down the flow; it's not a procedure call.

mqbrks wrote:
Also is this logic good??


No.

mqbrks wrote:
One of my friend says to have a subflow (for retry) after the IMS request and route back the request to the IN terminal of the IMS request node.


That sucks too.

mqbrks wrote:
I feel using handler reduces the number of nodes.


The only reason to worry about the number of nodes in a flow is if you have a stupid number of them (like node labels are so crammed together on the Toolkit canvas and/or you're using both of the scroll bars to see the entire flow) or you have a really, really tight SLA and you're trying to squeeze microseconds out of the flow.

mqbrks wrote:
Your inputs are really appreciated.


I would push the retry logic into a flow (not a subflow) headed by a Timer node, adding logic to count how many times the flows been retried - once you hit 3 the flow cancels the timer and does whatever you do for a persistent IMS error. This method has the additional advantage that you can allow a little time between retries rather than just banging away at IMS 4 times in a row. It's more likely that a transient problem will not go away between the original attempt & the 3rd immediate retry, but might do if you wait 5 seconds between attempts.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqbrks
PostPosted: Fri Jan 20, 2017 2:02 pm    Post subject: Re: Exception Handler in ESQL - IMS Request Reply with quote

Voyager

Joined: 17 Jan 2012
Posts: 75

Quote:

I would push the retry logic into a flow (not a subflow) headed by a Timer node, adding logic to count how many times the flows been retried - once you hit 3 the flow cancels the timer and does whatever you do for a persistent IMS error. This method has the additional advantage that you can allow a little time between retries rather than just banging away at IMS 4 times in a row. It's more likely that a transient problem will not go away between the original attempt & the 3rd immediate retry, but might do if you wait 5 seconds between attempts.


Thank you jeff and vitor for your inputs!!

But the problem here is we need to accumulate all the ACKs and process remaining records in the file. When we use timer flow it is disconnected from the main file process right? [/quote]
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Jan 20, 2017 10:33 pm    Post subject: Re: Exception Handler in ESQL - IMS Request Reply with quote

Jedi Council

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

mqbrks wrote:


But the problem here is we need to accumulate all the ACKs and process remaining records in the file. When we use timer flow it is disconnected from the main file process right?


Yes. A timer node event starts a new process thread.
_________________
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
Vitor
PostPosted: Mon Jan 23, 2017 5:05 am    Post subject: Re: Exception Handler in ESQL - IMS Request Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mqbrks wrote:
But the problem here is we need to accumulate all the ACKs and process remaining records in the file. When we use timer flow it is disconnected from the main file process right?


Yes, and why is that a problem?
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Exception Handler in ESQL - IMS Request
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.