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 » Array subscript error

Post new topic  Reply to topic
 Array subscript error « View previous topic :: View next topic » 
Author Message
siri2083
PostPosted: Thu Apr 23, 2009 11:17 pm    Post subject: Array subscript error Reply with quote

Apprentice

Joined: 16 Apr 2009
Posts: 38

Hi,

I am facing an error saying 'Array subscript error' when i am trying to assign to an environment variable.

my code looks like below:

DECLARE IN_IDs INTEGER;
SET IN_IDs = CARDINALITY(Environment.Variables.BeforeImage.allClients.Client[]);
WHILE IN_IDs <> 0 DO
SET Environment.Variables.BeforeImage.MembershipsDetails.Membership[IN_IDs].Details[]= SELECT MEMSHIP.CLIENTID, MEMSHIP.MEMBERSHIPNUMBER, MEMSHIP.MEMBERSHIPTYPE,MEMSHIP.MEMBERSHIPSTARTDATE,MEMSHIP.MEMBERSHIPSTATUS FROM Database.ADMINISTRATOR.IAL_RT_MEMBERSHIP AS MEMSHIP WHERE MEMSHIP.CLIENTID = Environment.Variables.BeforeImage.allClients.Client[IN_IDs].CLIENTID;
SET IN_IDs = IN_IDs - 1;
END WHILE;


Please note here CLIENTID is not a primary key. so for each ClientId, i need to retrive all the info from the DB table and assign to environment tree.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Apr 23, 2009 11:31 pm    Post subject: Reply with quote

Grand High Poobah

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

It's not clear from this snippit if the Environment.Variables.BeforeImage.MembershipDetails.Membership tree exists when the code is run. This is a different tree from the Environment.Varables.BeforeImage.allClients.Client, despite being stored in the same area.

If it doesn't exist, you're attempting to create the IN_IDth element before the IN_IDth-1 is in place. That's not allowed and will give you the error you quote; go up not down.

If it does exist, use trace (or other diagnostic) to check both trees have the same cardinality.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
siri2083
PostPosted: Thu Apr 23, 2009 11:51 pm    Post subject: Reply with quote

Apprentice

Joined: 16 Apr 2009
Posts: 38

Hi,

Thanks for the reply. The problem is solved. the description of the problem is:

i am trying to assign Environment.Variables.BeforeImage.MembershipsDetails.Membership[IN_IDs].Details[].

for example for the first time IN_IDs = 3. where Environment.Variables.BeforeImage.MembershipsDetails.Membership[3].Details[]. array is not allowed to create untill it has Environment.Variables.BeforeImage.MembershipsDetails.Membership[2].Details[].


below code reolves the probelm:

DECLARE IN_IDs,Count INTEGER;
SET IN_IDs = CARDINALITY(Environment.Variables.BeforeImage.allClients.Client[]);
SET Count = 1;
WHILE Count <= IN_IDs DO
SET Environment.Variables.BeforeImage.MembershipsDetails.Membership[Count].Details[]= SELECT MEMSHIP.CLIENTID, MEMSHIP.MEMBERSHIPNUMBER, MEMSHIP.MEMBERSHIPTYPE,MEMSHIP.MEMBERSHIPSTARTDATE,MEMSHIP.MEMBERSHIPSTATUS FROM Database.ADMINISTRATOR.IAL_RT_MEMBERSHIP AS MEMSHIP WHERE MEMSHIP.CLIENTID = Environment.Variables.BeforeImage.allClients.Client[Count].CLIENTID;
SET Count= Count + 1;
END WHILE;
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 » Array subscript error
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.