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 » error referencing in procedure

Post new topic  Reply to topic
 error referencing in procedure « View previous topic :: View next topic » 
Author Message
pjaffe
PostPosted: Tue May 17, 2005 12:53 pm    Post subject: error referencing in procedure Reply with quote

Novice

Joined: 03 Sep 2004
Posts: 13

I have the following WMQI v5 code that is giving me a syntax error in the toolkit. I have to believe it is because I am doing something that is not valid as opposed to just missing a character somewhere. Maybe not. The cursor error is shown on line 5 after "trgt". I am not able to create the BAR file until I clear this error.

CREATE PROCEDURE SetIndex(IN trgt REFERENCE) BEGIN
DECLARE i,indexnum INT;
SET i = 1;
WHILE i <= 3 DO
SET trgt[i].SECTION_X = i;
SET i = i + 1;
END WHILE;
END;


The xml tree that it might populate could look like this before executing the procedure:

<root>
<dept>
<Name>A</Name>
</dept>
<dept>
<Name>B</Name>
</dept>
<dept>
<Name>C</Name>
</dept>
</root>

The procedure would be called as:

CALL SetIndex(OutputRoot.XML.Root.dept);

The expected result would be:

<root>
<dept>
<SECTION_X>1</SECTION_X>
<Name>A</Name>
</dept>
<dept>
<SECTION_X>2</SECTION_X>
<Name>B</Name>
</dept>
<dept>
<SECTION_X>3</SECTION_X>
<Name>C</Name>
</dept>
</root>


I am looking for suggestions about either how to correct what I have started or suggestions about a better way to build it. Please understand that the actual message tree is more complex and much larger.
Back to top
View user's profile Send private message
alexey
PostPosted: Tue May 17, 2005 1:57 pm    Post subject: Reply with quote

Acolyte

Joined: 18 Dec 2003
Posts: 62
Location: Israel

Hi,

AFAIK, you just can't use reference to a list, it is always one field under a reference - you will have to pass your array's parent to your function and than use myref.dept[i] in your loop, or try to use MOVE NEXTSIBLING and check the LASTMOVE and FIELDNAME. Somthing like:
Code:

CREATE PROCEDURE SetIndex(IN trgt REFERENCE) BEGIN
DECLARE i,indexnum INT;
SET i = 1;
DECLARE list_name CHAR FIELDNAME(trgt);

WHILE i <= 3 AND LASTMOVE(trgt) DO
SET trgt.SECTION_X = i;
REPEAT
MOVE trgt NEXTSIBLING;
UNTIL (FIELDNAME(trgt) = list_name) OR (LASTMOVE(trgt) = FALSE)
END REPEAT;
SET i = i + 1;
END WHILE;

END;


Hope it helps.

Alexey.
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 » error referencing in procedure
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.