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 » SELECT FROM DynRefVar

Post new topic  Reply to topic Goto page Previous  1, 2
 SELECT FROM DynRefVar « View previous topic :: View next topic » 
Author Message
longng
PostPosted: Tue Mar 12, 2013 8:43 pm    Post subject: Reply with quote

Apprentice

Joined: 22 Feb 2013
Posts: 42

marko.pitkanen wrote:
...
You could also try to build your own search / add routine with named loop over reference variable, move and leave statements. Then you perhaps can stop loop if you find the value from your list.

--
Marko


Thanks Marko, I am asking my developers to do that.
Back to top
View user's profile Send private message
Esa
PostPosted: Wed Mar 13, 2013 12:29 am    Post subject: Re: SELECT FROM DynRefVar Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

longng wrote:

I also try the approach posted by Esa

Code:

DECLARE xxx REFERENCE TO Environment.Variables.CustomerRequest.CorrelationId;

....

IF NOT EXISTS(xxx.{CorrId}[]) THEN
  SET xxx,{CorrId} = CorrId;
ELSE
 -- you have a match!
END IF;


but it does not seem to work for me as the test always returns negative (NOT EXISTS)...


There is a little typo in the code, it has a comma where it should have a dot. This is how it should be:

Code:
IF NOT EXISTS(xxx.{CorrId}[]) THEN
  SET xxx.{CorrId} = CorrId;
ELSE
 -- you have a match!
END IF;


I'm not 100% sure if you can put square brackets directly after a field variable, so you can try this alternative, too:

Code:
IF NOT EXISTS(xxx.{CorrId}.Id[]) THEN
  SET xxx.{CorrId}.Id = CorrId;
ELSE
 -- you have a match!
END IF;



But even if you got it working I doubt it would clearly outperform the SELECT alternative with the reference variable that you now have, it's just a bit more concise code.

I very much agree with kimbert, you would get the best performance with java. You could create an ESQL wrapper over a java HashMap or Hashtable, but there is a subtle caveat. The java methods have to be static, which means that the Hashtable will have to be static, too. So you will have to clean up the table for every new flow instance and plan it even more carefully if you need to run the flow with additional instances. From that point of view a JCN would be a simple alternative. If you have developers with java skills combined with common sense.

Where do you get the correlation id's you populate the list with? You didn't answer my question about if you are looping with MQGet nodes.

marko.pitkanen wrote:
...
You could also try to build your own search / add routine with named loop over reference variable, move and leave statements. Then you perhaps can stop loop if you find the value from your list.

--
Marko

You would probably end up with about the same level of performance as with the select code you now have...
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Mar 13, 2013 12:51 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

If
a) this lookup is really the main performance issue ( and I agree with Esa that you should be cautious about assuming that )
AND
b) the number of correlation ids is large

then I still believe that a binary search on a sorted list of correlation ids would take less CPU than a linear search.

( just seen Esa's post. HashMap may also work well. It's very easy to try both solutions and see which one works best )
Back to top
View user's profile Send private message
longng
PostPosted: Wed Mar 13, 2013 6:36 pm    Post subject: Re: SELECT FROM DynRefVar Reply with quote

Apprentice

Joined: 22 Feb 2013
Posts: 42

Esa wrote:

...
There is a little typo in the code, it has a comma where it should have a dot. This is how it should be:

Code:
IF NOT EXISTS(xxx.{CorrId}[]) THEN
  SET xxx.{CorrId} = CorrId;
ELSE
 -- you have a match!
END IF;


I'm not 100% sure if you can put square brackets directly after a field variable, so you can try this alternative, too:

Code:
IF NOT EXISTS(xxx.{CorrId}.Id[]) THEN
  SET xxx.{CorrId}.Id = CorrId;
ELSE
 -- you have a match!
END IF;



...

Where do you get the correlation id's you populate the list with? You didn't answer my question about if you are looping with MQGet nodes.

marko.pitkanen wrote:
...
You could also try to build your own search / add routine with named loop over reference variable, move and leave statements. Then you perhaps can stop loop if you find the value from your list.

--
Marko

You would probably end up with about the same level of performance as with the select code you now have...




I am really sorry guys.... it's one of those days that I cann't seem to be able to get out of endless meetings.....

Thanks to everyone for responding and I do have some interesting results to share with you when I have a chance....

@Esa: It was rather an arbitrary choice of mine to use the variable named CorrelationId as I only wanted to convey that the values were meant to be unique for those of us familiar with WMQ/WMB. Unfortunately, I realize that it could also be taken literally! Sorry... Those values are purely fictional as they do not reprepsent CorrelationID of multiple MQGet's.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » SELECT FROM DynRefVar
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.