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 » ESQL question - array / stack implementation

Post new topic  Reply to topic
 ESQL question - array / stack implementation « View previous topic :: View next topic » 
Author Message
CHERIANV
PostPosted: Tue Oct 25, 2005 8:54 am    Post subject: ESQL question - array / stack implementation Reply with quote

Apprentice

Joined: 15 Feb 2002
Posts: 43
Location: New York

Hi,
I have a situation where I need to store the value of a particular field in every occurence of the XML that I process and then check that value against the folllowing occurences to validate if I processed it. Originally, my understanding was that I just needed to compare the current from the previous but now it seems like I may need to compare the current value against all the values that I already processed. For eg. in the ESQL snippet below, the CURRENT_ITEM changes for every iteration and most importantly it may repeat elsewhere and I need to store an array of CURRENT ITEMS in a stack or someplace so I can compare it with all that I processed so I can exclude it if I already processed it. What is the best way of doing it ? Any sample ESQL would be appreciated.

WHILE I <= PACKOUT_DTL_CNT DO

SET CURRENT_ITEM = InputRoot.XML.PACKOUT_DTLS[I].EXTERNLINENUMBER;

IF ( CURRENT_ITEM <> PREVIOUS_ITEM) THEN
{Process logic}

END IF;

SET PREVIOUS_ITEM = CURRENT_ITEM;
SET J = J + 1;
SET I = I + 1;

END WHILE;
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Oct 25, 2005 8:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You appear to already know how to handle multiple occurances of an element with the same name in a logical message tree - there is no ARRAY in ESQL.

What you do to store and check for duplicates in PREVIOUS_ITEM[*] depends entirely on the scope of PREVIOUS_ITEM. Is it *just* in the *current* message?

Or is it across different messages?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
JT
PostPosted: Tue Oct 25, 2005 9:03 am    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

Two caching vehicles come to mind:
  • Database
  • Broker Memory Store (IA91)
Back to top
View user's profile Send private message
CHERIANV
PostPosted: Tue Oct 25, 2005 10:05 am    Post subject: Reply with quote

Apprentice

Joined: 15 Feb 2002
Posts: 43
Location: New York

Jeff,
It is just in the *current* message . Currently, I'm just comparing the current and previous item and processing every unique item . For eg., assuming I have line items 10,10,10,20,20,30,30, 40.....in every occurence of the XML I am processing only items 10, 20, 30 and 40 with the current logic which is fine. But I seem to be getting data like 10,10,20,20,20,10,10,30,30,20,40,10,10... In this case, I need the process XML occurences only for 10,20,30 and 40 and should somehow ignore the 10's and 20's that come after during my iteration. So, what is the best way to dynamically store every item I pocess so I that I can compare every current item I process with all previous items instead of just the logic I now have in place which is just one before.

NOTE: The original assumption was that they would be in sequence and would be grouped together ...
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Oct 25, 2005 10:10 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Like I said, you already know what an ESQL "array" looks like.

Other than using an array and storing each item number in an entry, and then checking the array to see if you should skip or not, there are some of the usual ways to do it. For instance, using a string instead of an array and using POSITION instead of a loop.

The best way depends on your circumstances and your definition of "best".

Is "best" the same as "the most runtime efficient"? Or is it is "as runtime efficient as reasonable, but not to the point of making code hard to maintain or understand"? Or is it "the least number of lines of code"?

You could use an XSLT to sort the elements.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
CHERIANV
PostPosted: Tue Oct 25, 2005 2:36 pm    Post subject: Reply with quote

Apprentice

Joined: 15 Feb 2002
Posts: 43
Location: New York

Thanks! I used POSITION as an immediate workaround for the problem at hand.
Back to top
View user's profile Send private message
Fabrizio151288
PostPosted: Tue Aug 03, 2021 9:33 am    Post subject: Reply with quote

Newbie

Joined: 03 Aug 2021
Posts: 1

CHERIANV wrote:
Thanks! I used POSITION as an immediate workaround for the problem at hand.



Hello I have the same problem can you show me an example on how you fixed this using POSITION please?

Thank you very mutch in advance.
Back to top
View user's profile Send private message
timber
PostPosted: Sat Aug 07, 2021 7:15 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

The last post on this thread was 16 years ago. Any solution from 2005 will probably be out of date. Please open a new thread and supply full details of your problem.
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 » ESQL question - array / stack implementation
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.