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 » Loopinf in ESQL : FOR v/s WHILE using LASTMOVE

Post new topic  Reply to topic
 Loopinf in ESQL : FOR v/s WHILE using LASTMOVE « View previous topic :: View next topic » 
Author Message
keenlearner
PostPosted: Thu Aug 13, 2009 8:48 pm    Post subject: Loopinf in ESQL : FOR v/s WHILE using LASTMOVE Reply with quote

Acolyte

Joined: 24 Aug 2006
Posts: 62

Hi All

We are in a position where we want to understand which loop method is more advantageous FOR or WHILE

The syntax for FOR is

FOR refVariable AS referenc.child[] DO
END FOR

WHILE LASTMOVE(refVariable)
MOVE refVariable TO NEXTSIBLING
END WHILE;

The reason for this being we are getting a very large message and looping causes broker to abend. Though there are N number of ways to resolve this issue but we want to make sure that we are using the correct looping method.

any help would be much appreciatied.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Aug 14, 2009 4:53 am    Post subject: Reply with quote

Grand High Poobah

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

The search function will turn up a number of potentially useful discussions on this. There are also some redbooks on the subject that might help.

In your situation I'd consider using NEXTSIBLING and pruning the message tree as you go.

I'm also interested in why exactly the broker is abending. It's important to handle large messages efficiently, but shouldn't blow if you don't. Just sit & burn CPU.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Mon Aug 17, 2009 5:58 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Vitor wrote:

I'm also interested in why exactly the broker is abending. It's important to handle large messages efficiently, but shouldn't blow if you don't. Just sit & burn CPU.


Depends what you mean by "large". previously when doing an immediate parse for 30MB CSV messages i've seen the broker abend with out of memory errors because it exceeded the 1gb limit. To resolve this the large memory handling techniques were then to be used and all was well.
Back to top
View user's profile Send private message
keenlearner
PostPosted: Thu Aug 20, 2009 5:39 am    Post subject: Reply with quote

Acolyte

Joined: 24 Aug 2006
Posts: 62

hey....problem here is not handling large message.... as I have written in post as well that there are N number of ways to handle large messages... and we know some of them and successfully implemented the same.

I wanted to have a feedback on the loop statement .... which is better FOR loop of the while loop using the lastmove fucntion.


@Vitor.... Definitely the search option would have been resulted various results but nothing would have given what I am looking for. Hence raised the issue.
secondly referring to red books is always an answer to all questions posted in the forums.
Back to top
View user's profile Send private message
fschofer
PostPosted: Thu Aug 20, 2009 6:30 am    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

Hi,

i tend to use FOR loops where possible as moving the references is done internally and it is less code with less potential for errors.

As we all know a missing MOVE NEXTSIBLING will lead to a endless loop.

But there are some cases where WHILE LASTMOVE has to be used for example when deleting some of the elements during the loop.

Greetings
Frank
Back to top
View user's profile Send private message Send e-mail
WMBDEV1
PostPosted: Thu Aug 20, 2009 6:42 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

I'm not sure what your point is with this statement (but i'm probably just missing it so please feel free to explain it to me!)....
fschofer wrote:

As we all know a missing MOVE NEXTSIBLING will lead to a endless loop.


If we miss the code to increment the loop variable in a for loop we will also loop forever. Infinite loops are not caused by the fact we are using pointers!


Quote:

But there are some cases where WHILE LASTMOVE has to be used for example when deleting some of the elements during the loop.


Using NEXTSIBLING instead of indices to access the message tree will perform significantly better as the message tree grows larger.


Last edited by WMBDEV1 on Thu Aug 20, 2009 6:45 am; edited 1 time in total
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Thu Aug 20, 2009 6:43 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

keenlearner wrote:
hey....problem here is not handling large message....


Are you sure?

Please share how you came to this conclusion....
Quote:

The reason for this being we are getting a very large message and looping causes broker to abend.
Back to top
View user's profile Send private message
fschofer
PostPosted: Thu Aug 20, 2009 7:47 am    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

WMBDEV1 wrote:

If we miss the code to increment the loop variable in a for loop we will also loop forever. Infinite loops are not caused by the fact we are using pointers!


When using the syntax below (FOR loop using references) then the moving of the reference is done automatically by the broker.
Code:
FOR refVariable AS referenc.child[] DO
END FOR


Only when using a FOR loop with indices then the indice value has to be increased with a separate line of code.

Greetings
Frank
Back to top
View user's profile Send private message Send e-mail
WMBDEV1
PostPosted: Thu Aug 20, 2009 8:01 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Thanks Frank, i've not used that syntax before... but now i've learnt something new today

My other comments are still true though although maybe a little less relevant as the question is slightly different to the one I thought I was answering! My bad
Back to top
View user's profile Send private message
keenlearner
PostPosted: Fri Aug 21, 2009 1:59 am    Post subject: Reply with quote

Acolyte

Joined: 24 Aug 2006
Posts: 62

Hi WMBDEV1

We are receiving flat files which are over 50 MB in size but that is not over problem ... we are splitting the files before it is begin read into the broker. So there is no problem in handling large messages.

Let me rephrase my query:

Which Loop statement is better in terms of performance

1) For loop

2) While loop

in esql.
Back to top
View user's profile Send private message
fschofer
PostPosted: Fri Aug 21, 2009 2:09 am    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

Hi,

Quote:
Which Loop statement is better in terms of performance

1) For loop

2) While loop


Should be easy to determine this by executing some performance tests on your own.

But depending on the work which is done inside the loop it should not matter very much to use FOR or WHILE loops.
If there are several lines of code within the loop i assume the difference to be marginally.

Greetings
Frank
Back to top
View user's profile Send private message Send e-mail
keenlearner
PostPosted: Fri Aug 21, 2009 3:10 am    Post subject: Reply with quote

Acolyte

Joined: 24 Aug 2006
Posts: 62

Yes we definitely tried it and did not get a significant difference rather no diffrence at all for a xml file which has 5000 records. Just wondering some body have any specific details on it
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 » Loopinf in ESQL : FOR v/s WHILE using LASTMOVE
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.