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 » Initializing array in ESQL

Post new topic  Reply to topic
 Initializing array in ESQL « View previous topic :: View next topic » 
Author Message
ENVYMB
PostPosted: Tue Nov 19, 2013 10:08 pm    Post subject: Initializing array in ESQL Reply with quote

Newbie

Joined: 19 Nov 2013
Posts: 7

Hi,

I want to use an array in my esql and populate it with some data, which will be accessed in the later code. I have tried the below option and able to succeed.
SET vCount =1;
DECLARE vm ROW;
SET vm.Name[1]= '13';
SET vm.Name[2] = '08';
SET vm.Name[3] = '25';
SET vm.Name[4] = '06';
DECLARE vLen INTEGER;
SET vLen = CARDINALITY(vm.Name[]);
WHILE vCount <= vLen DO
Access array
SET vCount = vCount + 1;
END WHILE;

I want to know is there any way to intialize the array elements in single stattement rather than using multiple SET ststements. Please reply if any thoughts.

Thanks.
Back to top
View user's profile Send private message
Esa
PostPosted: Tue Nov 19, 2013 10:34 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

You can do it by combining LIST and ROW constructors.
Back to top
View user's profile Send private message
Simbu
PostPosted: Wed Nov 20, 2013 2:00 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

Esa wrote:
You can do it by combining LIST and ROW constructors.


LIST is sufficient to achieve this.
Quote:

DECLARE vm ROW;
SET vm.Name[] = LIST{13,08,25,06};
Back to top
View user's profile Send private message
ENVYMB
PostPosted: Wed Nov 20, 2013 10:34 pm    Post subject: Reply with quote

Newbie

Joined: 19 Nov 2013
Posts: 7

Thanks Simbu. This approach worked out !

Thanks Esa for your reply.

ENVYMB
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 » Initializing array 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.