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 » esql problem

Post new topic  Reply to topic
 esql problem « View previous topic :: View next topic » 
Author Message
jeevan
PostPosted: Tue Jan 23, 2007 5:58 pm    Post subject: esql problem Reply with quote

Grand Master

Joined: 12 Nov 2005
Posts: 1432

The following is my esql code. When I observed with visual debugger, the control jumps to CopyEntireMessage() procedure after executing DECLARE card Integer statement. Even the procedure has not been called( it is commented out).

I could not figure out what is the mistake. Why the other DECLARATION lines are not executed.

I would really appreciate your help,

===================eslq code=====================

CREATE COMPUTE MODULE database_flow_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
DECLARE card Integer;
SET card = CARDINALITY(InputBody.SUPPLIER.*[]);
DECLARE SUPPLIER_ID CHAR;
DECLARE NAME CHAR;
DECLARE CITY CHAR;


DECLARE InputMsg REFERENCE TO InutBody.SUPPPLIER;

-- WHILE card>0


DECLARE rec REFERENCE TO InutBody.SUPPPLIER.SUPPLIER_DETAIL[1];

SET SUPPLIER_ID=ref.SUPPLIER_ID;
SET NAME=ref.NAMES;
SET CITY=ref.CITY;

SET OutputRoot =InputMsg;
--CALL CopyEntireMessage();
RETURN TRUE;
-- END WHILE
END;

CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER;
DECLARE J INTEGER;
SET I = 1;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;

CREATE PROCEDURE CopyEntireMessage() BEGIN

--SET OutputRoot = InputRoot;
END;
END MODULE;

My inpupt xml is as follows:

==========================
<SUPPLIER>
<SUPPLIER_DETAIL>
<SUPPLIER_ID> S1 </SUPPLIER_ID>
<NAME>NorthPole Printers </NAME>
<CITY>Chicago </CITY>
</SUPPLIER_DETAIL>
<SUPPLIER_DETAIL>
<SUPPLIER_ID> S2 </SUPPLIER_ID>
<NAME>Oxford Press</NAME>
<CITY>Fairfield </CITY>
</SUPPLIER_DETAIL>
<SUPPLIER_DETAIL>
<SUPPLIER_ID> S3 </SUPPLIER_ID>
<NAME>Houghton </NAME>
<CITY>St. Paul </CITY>
</SUPPLIER_DETAIL>
</SUPPLIER>
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jan 23, 2007 6:10 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Because you didn't redeploy your flow after updating your code?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jeevan
PostPosted: Tue Jan 23, 2007 6:18 pm    Post subject: Reply with quote

Grand Master

Joined: 12 Nov 2005
Posts: 1432

No Jeff. Before I post the message, I checked everything carefully. It is doing the same again. In fact, from the first declare it jumps to copymessage procedure. It comes back to next line then the controller leaves the compute node.


any idea what mistake did I do?

I reployed the msgflow.

thanks
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jan 23, 2007 6:37 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I've done this myself.

I've changed the code, and forgotten to redeploy - or forgotten which environment I've redeployed to, and then tried to debug....

And gotten confused why the debugger doesn't really step through my code properly....

Other than that, I would check for phantom execution groups.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
narendrach
PostPosted: Tue Jan 23, 2007 7:20 pm    Post subject: Reply with quote

Voyager

Joined: 29 Jun 2005
Posts: 78

hi jeevan,


if you redeploy your flow after updating your code?

check how many instances of that flow are running
check that by using mqsc command mqsilist <broker_name> -e <Execution group name>

some times old instances of the flow will not get deleted
_________________
Narendra CH
Back to top
View user's profile Send private message Yahoo Messenger
ravi_sri24
PostPosted: Tue Jan 23, 2007 8:36 pm    Post subject: Reply with quote

Voyager

Joined: 11 May 2006
Posts: 83

Hi Jeevan,

I think Intially you deployed the code in multiple execution groups later you deployed the code in only one execution group

check once again and redeploy the code in all the execution groups and try again
Back to top
View user's profile Send private message
ravi_sri24
PostPosted: Tue Jan 23, 2007 8:47 pm    Post subject: Reply with quote

Voyager

Joined: 11 May 2006
Posts: 83

Hi Jeevan,

sure i assure you that you have not deployed the code properly, because there are few error's in your code

DECLARE rec REFERENCE TO InutBody.SUPPPLIER.SUPPLIER_DETAIL[1];

SET SUPPLIER_ID=ref.SUPPLIER_ID;
SET NAME=ref.NAMES;
SET CITY=ref.CITY;


in the a bove code "rec" is refering to the InutBody.SUPPPLIER.SUPPLIER_DETAIL[1]; but you are using "ref" for getting the values of the supplier_id and others


After deploying your flow please check the event log of your broker in the toolkit there you can find the flow is deployed propery or not, if there are any errors with the esql code there it will show
Back to top
View user's profile Send private message
jeevan
PostPosted: Wed Jan 24, 2007 1:51 pm    Post subject: Reply with quote

Grand Master

Joined: 12 Nov 2005
Posts: 1432

Thank you all for your input. I resolved that problem. Belive me, it was neither :

redeployment
forgotten to deploy in some exe grp
also, there were not any phantom exe grp

But I agree many times these causes this problem. Yesterday, I resolved when I stop and start broker, delete the flow from exegrp and redeployed again.

I have further problem. I would appreciate, for your input and insight.

===========================================

the following is my whole esql



CREATE COMPUTE MODULE database_flow_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
DECLARE card Integer;
SET card = CARDINALITY(InputBody.SUPPLIER.*[]);
DECLARE InputMsg REFERENCE TO InputBody.SUPPLIER;
DECLARE I Integer 1;
DECLARE SUPPLIER_ID CHAR;
DECLARE NAME CHAR;
DECLARE CITY CHAR;
DECLARE rec2 CHAR;

WHILE card>0 DO
DECLARE rec REFERENCE TO InputBody.SUPPPLIER.SUPPLIER_DETAIL[I];

DECLARE rec1 REFERENCE TO InputBody.SUPPPLIER.SUPPLIER_DETAIL;
DECLARE rec3 REFERENCE TO InputBody.SUPPPLIER;
SET rec2= InputBody.SUPPPLIER.SUPPLIER_DETAIL[I].SUPPLIER_ID;

-- SET SUPPLIER_ID=rec.SUPPLIER_ID;
-- SET NAME=rec.NAME;
-- SET CITY=rec.CITY;

INSERT INTO Database.SUPPLIER(SUPPLIER_ID,NAME,CITY) VALUES(rec.SUPPLIER_ID, rec.NAME, rec.CITY);

SET OutputRoot =InputMsg;
--CALL CopyEntireMessage();
SET card =card-1;
SET I = I+1;
END WHILE;
RETURN TRUE;
END;

CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER;
DECLARE J INTEGER;
SET I = 1;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;

CREATE PROCEDURE CopyEntireMessage() BEGIN

--SET OutputRoot = InputRoot;
END;
END MODULE;

===========================================

I am receiving XML input which contains supplier records. a supplier record has three elements:

supplier_id
name
city

I want ( have to ) insert this data into database. But I am getting error in INSERT statement. I have seen similar example in warehouse sample program but I am getting error in the similar statement.


also you can see, rec1,rec3 and rec2 are there. I have had these just for test purpose. To my wonder, all rec, InputMsg,rec1 and rec3 have same content - the whole xml tree

supplier
supplier_details
supplier_details

supplier_details
supplier_details

supplier_details
supplier_details
supplier

How InputBody.SUPPLIER InputBody. SUPPLIER.SUPPLIER_DETAILS[1] and InputBody.SUPPPLIER have same value? is this the nature of REFERENCE TO assignment ?

Also, rec2 does not have any value. Why so ? What is wrong ?

I could not figure out as there is syntax error but having problem in executing.

Thank you very much for your coopreation
Back to top
View user's profile Send private message
gregop
PostPosted: Thu Jan 25, 2007 12:10 am    Post subject: Reply with quote

Voyager

Joined: 24 Nov 2006
Posts: 81

[/quote]DECLARE rec REFERENCE TO InutBody.SUPPPLIER.SUPPLIER_DETAIL[1];
Quote:


This will assign an initial value only.

No need to process with indexes when you are using references. Take a look at 'Reference' in the info center for some examples. Use MOVE to traverse the tree. Your code could be something like this:

-- Set reference to first instance
DECLARE rec REFERENCE TO InputBody.SUPPPLIER.SUPPLIER_DETAIL ;

WHILE LASTMOVE(rec) DO
INSERT INTO Database.SUPPLIER(SUPPLIER_ID,NAME,CITY) VALUES(rec.SUPPLIER_ID, rec.NAME, rec.CITY);
MOVE rec NEXTSIBLING REPEAT TYPE NAME;
END WHILE;
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jan 25, 2007 12:19 am    Post subject: Reply with quote

Grand High Poobah

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

This seems to be a partial double post of http://www.mqseries.net/phpBB2/viewtopic.php?t=34677

Your code (as elvis_gn points out) says:

Code:
DECLARE rec REFERENCE TO InputBody.SUPPPLIER.SUPPLIER_DETAIL[I]


1st qualifier spelt SUPPPLIER not the root XML tag supplier.

Note also XML is case sensitive so supplier <> SUPPLIER even if they both have the same number of Ps in them. Either or both of these issue will cause the reference to produce results you don't expect.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Thu Jan 25, 2007 12:20 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi jeevan,

Could this the the reason for all your problems....
http://www.mqseries.net/phpBB2/viewtopic.php?t=34677

Regards.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » esql problem
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.