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 » Dynamic queue manipulation using ESQL in WMBv6.2

Post new topic  Reply to topic
 Dynamic queue manipulation using ESQL in WMBv6.2 « View previous topic :: View next topic » 
Author Message
Hitesh Jain
PostPosted: Fri Dec 24, 2010 6:09 am    Post subject: Dynamic queue manipulation using ESQL in WMBv6.2 Reply with quote

Novice

Joined: 24 Dec 2010
Posts: 16

Hi i am having problem with the dynamic queue manipulation logic in my error handler esql. Here is my code sample...

If (errLabel ='ABC')Then
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE27';
Propagate TO TERMINAL 'out' Message InputRoot ;
Elseif (errLabel ='VFC_WMB_WCS_B2B_SERIAL')Then
IF (InputRoot.XMLNS.NSSALESREP01:SapYsalesrep01.SapYsalesrep01IDocBO.SapIDocControlRecord.IDOCTYP = SALESREPROSTERIDOCTYP) THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE26';
Propagate TO TERMINAL 'out' Message InputRoot;
ELSEIF (InputRoot.XMLNS.NSYSAORST:SapYsaorst01.SapYsaorst01IDocBO.SapIDocControlRecord.IDOCTYP = ORDSTATUSIDOCTYP) THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE25';
Propagate TO TERMINAL 'out' Message InputRoot;
ELSEIF (InputRoot.XMLNS.NSHRMDA1:SapHrmdA01Yhrmda1.SapHrmdA01Yhrmda1IDocBO.SapIDocControlRecord.Idoctyp =SALESREPMASTERIDOCTYP ) THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE24';
Propagate TO TERMINAL 'out' Message InputRoot;
ELSEIF (InputRoot.XMLNS.NSDEBMAS:SapDebmas04YDebmas.SapDebmas04YDebmasIDocBO.SapIDocControlRecord.IDOCTYP= CUSTMASTERIDOCTYP) THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE23';
Propagate TO TERMINAL 'out' Message InputRoot;
End if ;
Elseif (errLabel ='DEF')Then
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE22';
Propagate TO TERMINAL 'out' Message InputRoot;
Elseif (errLabel ='GHI')Then
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE21';
Propagate TO TERMINAL 'out' Message InputRoot;
Elseif (errLabel ='JKL')Then
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE20';
Propagate TO TERMINAL 'out' Message InputRoot;
Elseif (errLabel ='MNO')Then
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE28';
Propagate TO TERMINAL 'out' Message InputRoot;
Else
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE29';
Propagate TO TERMINAL 'out' Message InputRoot;
End if;
Back to top
View user's profile Send private message Send e-mail
fatherjack
PostPosted: Fri Dec 24, 2010 6:13 am    Post subject: Re: Dynamic queue manipulation using ESQL in WMBv6.2 Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

Hitesh Jain wrote:
Hi i am having problem with the dynamic queue manipulation logic


Care to expand a little on your problem.
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
Hitesh Jain
PostPosted: Fri Dec 24, 2010 6:59 am    Post subject: Reply with quote

Novice

Joined: 24 Dec 2010
Posts: 16

I want the answer whether i am doing wrong or right. If wrong then want the correct way for the manipulation
Back to top
View user's profile Send private message Send e-mail
Hitesh Jain
PostPosted: Fri Dec 24, 2010 7:01 am    Post subject: Reply with quote

Novice

Joined: 24 Dec 2010
Posts: 16

I want to manipulate different error IDOCS to different queues based on their IDocTyp so how will be i able to achieve this????
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Fri Dec 24, 2010 7:39 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Hitesh Jain wrote:
I want the answer whether i am doing wrong or right.



Does the code work?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Dec 24, 2010 7:47 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.

Nested If's are ok but IMHO above 3 or 4 nests it gets a bit messy

Look at the CASE statement.
It is a lot more readable and extensible
_________________
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
Hitesh Jain
PostPosted: Fri Dec 24, 2010 8:35 am    Post subject: Reply with quote

Novice

Joined: 24 Dec 2010
Posts: 16

Yeah sometimes it works and sumtimes it automatically fails and does not give any error....
Back to top
View user's profile Send private message Send e-mail
sankritya
PostPosted: Fri Dec 24, 2010 6:59 pm    Post subject: Reply with quote

Centurion

Joined: 14 Feb 2008
Posts: 100

Quote:
Elseif (errLabel ='VFC_WMB_WCS_B2B_SERIAL')Then
IF (InputRoot.XMLNS.NSSALESREP01:SapYsalesrep01.SapYsalesrep01IDocBO.SapIDocControlRecord.IDOCTYP = SALESREPROSTERIDOCTYP) THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE26';
Propagate TO TERMINAL 'out' Message InputRoot;
ELSEIF (InputRoot.XMLNS.NSYSAORST:SapYsaorst01.SapYsaorst01IDocBO.SapIDocControlRecord.IDOCTYP = ORDSTATUSIDOCTYP) THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE25';
Propagate TO TERMINAL 'out' Message InputRoot;
ELSEIF (InputRoot.XMLNS.NSHRMDA1:SapHrmdA01Yhrmda1.SapHrmdA01Yhrmda1IDocBO.SapIDocControlRecord.Idoctyp =SALESREPMASTERIDOCTYP ) THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE24';
Propagate TO TERMINAL 'out' Message InputRoot;
ELSEIF (InputRoot.XMLNS.NSDEBMAS:SapDebmas04YDebmas.SapDebmas04YDebmasIDocBO.SapIDocControlRecord.IDOCTYP= CUSTMASTERIDOCTYP) THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE23';
Propagate TO TERMINAL 'out' Message InputRoot;
End if ;


What if errLabel ='VFC_WMB_WCS_B2B_SERIAL' and none of the condition meets?
I think you need to add a Default ELSE in this too like given below to get output in all cases.
ELSE
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE29';
Propagate TO TERMINAL 'out' Message InputRoot;

Prefer CASE over the Nested IF- ELSE. It simplifies your tasks and makes it Presentable too.
Back to top
View user's profile Send private message
Hitesh Jain
PostPosted: Fri Dec 24, 2010 10:36 pm    Post subject: Reply with quote

Novice

Joined: 24 Dec 2010
Posts: 16

I dont know how to use CASE statement instead of nested if so it will better if you provide me with a sample code snippet....
Back to top
View user's profile Send private message Send e-mail
sankritya
PostPosted: Sat Dec 25, 2010 1:14 am    Post subject: Reply with quote

Centurion

Joined: 14 Feb 2008
Posts: 100

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ak04930_.htm
Back to top
View user's profile Send private message
Hitesh Jain
PostPosted: Sat Dec 25, 2010 1:17 am    Post subject: Reply with quote

Novice

Joined: 24 Dec 2010
Posts: 16

Thanx for the link i will try it and will let you know
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Sat Dec 25, 2010 1:47 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.

One general point about the problem.
If you set the Output Detination Queue Name to be the one where you go in case of none of the IF conditions OR the CASE not giving you a match BEFORE you start the nested IF or the CASE, you will always have a value for the destination no matter what happens in the IF/CASE operation.
I actually prefer doing things like this, this way. IMHO, this is SOP in Defensive Programming. It is like setting a default value.

And with ESQL setting a value to NULL (and thus deleting it) if you get a path failure in a SET operation, it makes debugging the issue that much easier.
_________________
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
fjb_saper
PostPosted: Sat Dec 25, 2010 5:30 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Quote:
SET OutputLocalEnvironment.Destination.MQ.DestinationData[0].queueName ='TESTQUE27';


What happens if you start your index with 1 instead of 0?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Dynamic queue manipulation using ESQL in WMBv6.2
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.