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 help

Post new topic  Reply to topic
 eSQL help « View previous topic :: View next topic » 
Author Message
madi
PostPosted: Fri Jan 27, 2006 1:23 pm    Post subject: eSQL help Reply with quote

Chevalier

Joined: 17 Jan 2006
Posts: 475

Hi

I am trying to generate an XML from name -value pairs and am using the following code.


DECLARE C INTEGER CARDINALITY(InputRoot.XML.InfoPublish.Item.ItemData.ItemAttr[]);
SET C = C + 1;
DECLARE K INTEGER 1;
WHILE K < C DO
DECLARE cursor REFERENCE TO InputRoot.XML.Publish.Item.ItemData.ItemAttr[K];
SET OutputRoot.XML.Item.ItemData.{FIELDVALUE(cursor.(XML.attr)name)} = FIELDVALUE(cursor.AttrValue.(XML.attr)value);
SET K = K + 1;
END WHILE;

Input Message:

<InfoPublish>
<Item>
<ItemData>
<ItemAttr name="ITEM_NUMBER" status="ADD"><AttrValue value="10217180"/></ItemAttr>
<ItemAttr name="MANUFACTURER" status="ADD"><AttrValue value="Mossimo Red"/></ItemAttr>
<ItemAttr name="SHIPPING" status="ADD"><AttrValue value="all_states_apo_prot"/></ItemAttr>
</ItemData>
</Item>
</InfoPublish>

Ouput MEssage:

- <Item>
- <ItemData>
<ITEM_NUMBER>10217180</ITEM_NUMBER>
<MANUFACTURER>Mossimo Red</MANUFACTURER>
<SHIPPING>all_states_apo_prot</SHIPPING>
</ItemData>
</Item>

Now My problem is, I used this example xml given above which has 3 pairs in it and the code worked fine and the code works for any message upto 6KB.

When I put in an xml which is more 6kB, it is not working!!

I think my code is generic and so should work irrespective of the number of ItemAttrs' in the input msg.

Not working for input message:

<InfoPublish>
<Item>
<ItemData>
<ItemAttr name="ITEM_NUMBER" status="ADD"><AttrValue value="10217180"/></ItemAttr>
<ItemAttr name="MANUFACTURER" status="ADD"><AttrValue value="Mossimo Red"/></ItemAttr>
<ItemAttr name="SHIPPING" status="ADD"><AttrValue value="all_states_apo_prot"/></ItemAttr>
<ItemAttr name="GIFT" status="ADD"><AttrValue value="Y"/></ItemAttr>
<ItemAttr name="POST_OFFICE" status="ADD"><AttrValue value="Y"/>
<ItemAttr name="MERCHANDISE" status="ADD"><AttrValue value="234"/></ItemAttr>
<ItemAttr name="DEPARTMENT" status="ADD"><AttrValue value="2"/></ItemAttr>
...
...
...
</ItemData>
</Item>
</InfoPublish>



Plz help
madi
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Fri Jan 27, 2006 8:00 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi madi,

Yes your code is generic.

I think the problem is, you are using
Quote:
SET OutputRoot.XML.Item.ItemData.{FIELDVALUE(cursor.(XML.attr)name)} = FIELDVALUE(cursor.AttrValue.(XML.attr)value);


Instead use CREATE FIELD(for first record) and CREATE NEXTSIBLING(for the rest).....

Tell us if it is fixed.

Regards.
Back to top
View user's profile Send private message Send e-mail
hemendra123
PostPosted: Sat Jan 28, 2006 8:12 pm    Post subject: Reply with quote

Novice

Joined: 30 May 2005
Posts: 20

Madi, Just try placing the PROPAGATE stmt in the loop, ofcourse after setting the outputroot, might help you.
_________________
Hemendr
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Sun Jan 29, 2006 3:32 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

That won't help at all. It will break out different messages, and I'm don't see any reason why Madi wants to do that.

Madi - don't use propagate unless you need different messages.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mgk
PostPosted: Mon Jan 30, 2006 1:31 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi,

Can you post what actually goes wrong here, as you do not say. Having said that, at a guess I would think elvis is correct. You are better off using CREATE FIELD for the first entry, and then using CREATE NEXTSIBLING for the rest. This is because if you have duplicate name attributes SET will cause previous ones to be rewritten, but CREATE will not.

Also DECLAREing youe cursor each time around the loop is slow and unnecessary. You should DECLARE it once outside the loop and MOVE it to the next item, specifing the REPEAT NAME clauses to skip over any whitespace (and then check LASTMOVE).

Finally jefflowrey is right as well, I see no need for PROPAGATE here, although as jeff's sig is "Things are going to change" and I was wondering when that sig is was going too .


Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
madi
PostPosted: Mon Jan 30, 2006 7:26 am    Post subject: Reply with quote

Chevalier

Joined: 17 Jan 2006
Posts: 475

Hi Guys

I think it is a problem with the XML but I need to check that.

I agree that setting cursor everytime is a waste and I will change that.

I have a new problem but guess it is a common one for me.

I tried to deploy the exec grp when the database was down.

Now the databse is up and running but the toolkit is dead. It is not allowing me to deploy saying the CONFIG MGR is still deploying the last one.

Nothing comes up in the event log, its just not doing anything.

I tried to stop the broker using mqsistop but that is taking forever.

Whats the best way to deal with this situation coz its like a common problem for me because the database is really unstable.

plz help
madi
Back to top
View user's profile Send private message
madi
PostPosted: Mon Jan 30, 2006 11:08 am    Post subject: Reply with quote

Chevalier

Joined: 17 Jan 2006
Posts: 475

Hi guys

thanks for all the help. I got it working

thanks again
madi
Back to top
View user's profile Send private message
javaforvivek
PostPosted: Mon Jan 30, 2006 10:37 pm    Post subject: Reply with quote

Master

Joined: 14 Jun 2002
Posts: 282
Location: Pune,India

Quote:
thanks for all the help. I got it working

which one you got working? your toolkit or your message transformation logic?

I tried your ESQL on my WMB, and it works fine without any modification to your code. But again, elvis and mgk have given you the optimized code and I recommend to use it instead of your original code.
These suggestions can be considered as one of the 'Best Practices' of writing ESQL!!
_________________
Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
madi
PostPosted: Tue Jan 31, 2006 7:16 am    Post subject: Reply with quote

Chevalier

Joined: 17 Jan 2006
Posts: 475

Hi vivek

I meant the transformation logic.

thanks
madi
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 » eSQL help
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.