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 - ESQL Mapping (XML repeat tag)

Post new topic  Reply to topic
 Array subscript error - ESQL Mapping (XML repeat tag) « View previous topic :: View next topic » 
Author Message
Vinayak.Satapute
PostPosted: Sun Aug 11, 2013 5:37 am    Post subject: Array subscript error - ESQL Mapping (XML repeat tag) Reply with quote

Acolyte

Joined: 20 Dec 2006
Posts: 70

Hi,

I have following code with "parameter" field as a repeated XML tag but I am getting array subscript error while I try to execute the code.

DECLARE I INTEGER 1;

SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I].(XMLNSC.Attribute)name = 'enginePattern';
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I] = 'RTLTM';

SET I = I + 1;
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I].(XMLNSC.Attribute)name = 'tradingDate';
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I] = 'dd/mm/yy='||CAST(dDATE AS CHAR);

SET I = I + 1;
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I].(XMLNSC.Attribute)name = 'useLatestValidatedEngine';
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I] = 'true';

SET I = I +1;
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I].(XMLNSC.Attribute)name = 'tickInput';

Appreciate your input here.
Thank You.
Back to top
View user's profile Send private message
dogorsy
PostPosted: Sun Aug 11, 2013 5:48 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

you have not said what the value of dDATE is. if it is NULL, then the element will not be created and you will get the error described.
use current_date instead of dDATE to ensure your code works.

Also, if your elements are fixed, why use an index ?
just specify [1], [2] and [3]

AND ... as you can see it is a big AND, if you had run a user trace, you would've seen very quickly where the problem is. So I gave you a clue, next, if you still have problems, get a user trace and look at it. It is a good way of understanding what your code is doing.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Sun Aug 11, 2013 8:51 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

I have defined 3 rules (which you are breaking!)
Instead of these rules, I could have just said "Always use REFERENCEs!" (But just saying that wouldn't have been so spectacular )

Using REFERENCEs is the conclusion (which derives from the 3 rules). And probably it's easier to understand. It's a much clearer advice, but may lead to the question "why?". Why is answered by a good understanding of the product (Message Broker) and/or comparing user traces.

It also wouldn't have been clear enough about what (unnecessarily) harms performance. In your case it also harms the code-robustness:

The use of INDEX ([]) tends to lead to "array out of bounds exceptions", which you can avoid by JUST NOT USING INDEX!
_________________
Just use REFERENCEs


Last edited by mqsiuser on Sun Aug 11, 2013 9:16 am; edited 1 time in total
Back to top
View user's profile Send private message
dogorsy
PostPosted: Sun Aug 11, 2013 9:07 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

mqsiuser wrote:
I have defined 3 rules (which you are breaking!)
Instead of these rules, I could have just said "Always use REFERENCEs!" (But just saying that wouldn't have been so spectacular )

Using REFERENCEs is the conclusion (which derives from the 3 rules). And probably it's easier to understand. It's a much clearer advice, but may lead to the question "why?". Why is answered by a good understanding of the product (Message Broker) and/or comparing user traces.

It also wouldn't have been clear enough about what (unnecessarily) harms performance. In your case it also harms the code-robustness:

The use of INDEX ([]) tends to lead to "array out of bounds exceptions", which you can avoid by JUST NOT USING INDEX!


I thought I was optimistic !... people do not read the doc, and you expect them to read your rules ?!!!!
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Sun Aug 11, 2013 9:22 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

I will be there to remind people
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Aug 11, 2013 10:53 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.

mqsiuser wrote:
I will be there to remind people


You vill obey ze rules, or you vill be made to work only in Java {said in an awful german accent}



{I am joking ok...}
_________________
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
mqsiuser
PostPosted: Sun Aug 11, 2013 11:50 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Java is great... for... äh... for... ja ... for... ja was denn nun...

Java-Application-Servers ... ... maybe?
The evolution of the IT industry
I need to talk with James Gosling, ah, no... Larry.

In Memory of the love-couple Java & XML
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
Vinayak.Satapute
PostPosted: Wed Aug 14, 2013 3:49 am    Post subject: Reply with quote

Acolyte

Joined: 20 Dec 2006
Posts: 70

dogorsy and guys,

Thanks for the inputs. It was 'dDate' variable causing the array index out of bound. Hence has been resolved.

Thanks Again. Cheers..
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 - ESQL Mapping (XML repeat tag)
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.