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 » Arrays in ESQL

Post new topic  Reply to topic
 Arrays in ESQL « View previous topic :: View next topic » 
Author Message
Deepika
PostPosted: Thu Jul 11, 2002 6:00 am    Post subject: Arrays in ESQL Reply with quote

Novice

Joined: 03 Jul 2002
Posts: 14

I want to use arrays in my ESQL to hold some data. Any one has any code example on how to do it.
many thanks
Back to top
View user's profile Send private message
kirani
PostPosted: Thu Jul 11, 2002 8:45 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

You could use Environment Tree to store array variables.
To set values in an Array use ESQL:
Code:

SET Environment.Variables.NameArr[1] = 'Name1';
SET Environment.Variables.NameArr[2] = 'Name2';
SET Environment.Variables.NameArr[3] = 'Name3';
SET Environment.Variables.NameArr[4] = 'Name4';


To loop thru array:
Code:

DECLARE TCNT INT;
DECLARE CNT INT;
SET TCNT = CARDINALITY(Environment.Variables.NameArr[]);
SET CNT = 1;

WHILE (I <= TCNT) DO
-- your processing goes here.
-- You could refer to arry using Environment.Variables.NameArr[I]
  SET I = I + 1;
END WHILE;
...


Hope this helps!
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
gopi_1203
PostPosted: Wed Aug 17, 2016 11:36 pm    Post subject: Reply with quote

Newbie

Joined: 17 Aug 2016
Posts: 2

we can use for loop to iterate the vaues
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Aug 18, 2016 12:34 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.

Can you please explain why you thought it a good thing to open a post from 2002?
That post was from the early days of this product. Time and the product have moved on since then.

Do you actually have a question?

If you do then please open a new thread and if needed, refer to the old one via a url.
_________________
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
Craig B
PostPosted: Tue Sep 20, 2016 2:48 am    Post subject: Reply with quote

Partisan

Joined: 18 Jun 2003
Posts: 316
Location: UK

I completely agree with the previous response. Demonstrating array index access in ESQL may be acceptable to small arrays but as soon as you scale up to many entries, the performance will be terrible. As a history lesson here each individual SET statement is executed individually and as such has to start at the first child and then go over each field checking for:

1) Is this the name of the field I need
2) Is this the Nth occurrence I am looking for.

So in the previous example if you are dealing with the 4th indexed element, the processing had to count over the previous 3 elements. Not a big deal with 4 elements, but now do this with hundreds of thousands of them.

The preferred approach here is to use REFERENCE variables and then use MOVE with NEXTSIBLING etc so that you are always navigating from the last point you last looked at.

Might be worth taking a look at the following tips in the documentation:

http://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/bj28653_.htm
_________________
Regards
Craig
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 » Arrays in ESQL
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.