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 » Copy part of XML message

Post new topic  Reply to topic
 Copy part of XML message « View previous topic :: View next topic » 
Author Message
klabran
PostPosted: Tue Feb 24, 2004 7:11 am    Post subject: Copy part of XML message Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

I have the following incoming message....

<CITATIONS>
<CITATION>
<CITINFO></CITINFO>
<CHARGES>
<CHARGE><CHARGEINFO></CHARGEINFO</CHARGE>
</CHARGES>
</CITATION>
<CITATION>
<CITINFO></CITINFO>
<CHARGES>
<CHARGE><CHARGEINFO></CHARGEINFO</CHARGE>
</CHARGES>
</CITATIONS>

I am using the propagate command to create a message for each individual Citation. I am wondering if their is a shortcut/command that would copy each Citation to the outputroot. My only thought at this time is to create a loop based on the cardinality of Citation and copy the info to outputroot that way (although haven't done this yet).

I am new to MQSI (I am using MQSI 2.1 CSD06) and am not seeing anything obvious yet that could do this....

I was hoping something like:
SET "OutputRoot"."XML" = "InputBody"."CITATIONS"."CITATION"[I];
However the above doesn't work...

Thanks for any assistance you can offer...
Kevin
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Tue Feb 24, 2004 7:31 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Show us a trace from before your compute node, your complete ESQL, a trace from after your compute node, and a sample of what you're expecting it to produce. Also, if you are seeing any errors in your system log or ESQL errors in the Control Center, post those too.

And read the ESQL Reference manual on the propagate function, and look in the readme file for CSD06. You might find sample code that would help.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Missam
PostPosted: Tue Feb 24, 2004 8:14 am    Post subject: Reply with quote

Chevalier

Joined: 16 Oct 2003
Posts: 424

There is a good example for this in ESQL Reference Under Subject Propagate.See page 64 in ESQL Reference
Back to top
View user's profile Send private message
klabran
PostPosted: Tue Feb 24, 2004 8:22 am    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Jeff,

Are you saying that ...

SET "OutputRoot"."XML" = "InputBody"."CITATIONS"."CITATION"[I];

should work?

I was more or less asking how to copy as efficiently as possible

Right now I am attempting to do the following....

SET D = 1;
DECLARE CIT_CARD INTEGER;
SET CIT_CARD = CARDINALITY(InputRoot."CITATIONS"."CITATION".*[]);
DECLARE S CHARACTER;
DECLARE F CHAR;
DECLARE CIT CHAR;
--Build OutputRoot Dynamically by looping through
--All Fields in Citation....
WHILE D < CIT_CARD DO
SET F = FIELDNAME("InputRoot"."CITATIONS"."CITATION"[D]);
SET CIT = EVAL("""InputRoot"".""CITATIONS"".""CITATION""[" || D || "].""" || F || "");
SET S = S || CIT;
SET D = D + 1;
END WHILE;
SET "OutputRoot"."XML"."TEST" = S;

I am not sure if this is the best way to do it, and at this time it is giving me a syntax error when I go to deploy it on the Eval line.... The correlation name '"InputRoot"."CITATIONS"."CITATION"[' is not valid.

I was hoping that their is an easier way to do this.

Thanks,
Kevin
Back to top
View user's profile Send private message Visit poster's website
klabran
PostPosted: Tue Feb 24, 2004 8:23 am    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

I obviously have the wrong version of the ESQL reference.... Page 64 is the syntax for the case statement. In looking at my reference it is for version 2.0.2...

Bummmer!
Back to top
View user's profile Send private message Visit poster's website
EddieA
PostPosted: Tue Feb 24, 2004 8:43 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

You need 2.1 (and a CSD ??) to use PROPOGATE.

And yes:
Quote:
SET "OutputRoot"."XML" = "InputBody"."CITATIONS"."CITATION"[I]

Should copy that section of the Input tree to the Output. But without PROPOGATE this isn't going to help, because you have to output that Output tree before you can do the next iteration. Otherwise the Output tree will have multipe 'root' tags, which is not legal.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Missam
PostPosted: Tue Feb 24, 2004 9:08 am    Post subject: Reply with quote

Chevalier

Joined: 16 Oct 2003
Posts: 424

klabran wrote

Quote:

I am new to MQSI (I am using MQSI 2.1 CSD06)

if you are using mqsi2.1 you need to refer to correct manual.
you can find documentation tab at the top this page click library home page and it will lead you to manuals you need to refer
Back to top
View user's profile Send private message
klabran
PostPosted: Tue Feb 24, 2004 9:45 am    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Thanks for pointing me in the right direction IamSam!

Eddie,

If I understand you correctly.... You are saying that I would need another compute node to then do further work on the message.

The first compute node would propagate each citation and then the second compute node would do further work necessary on each individual citation.... Yes/No?

Kevin
Back to top
View user's profile Send private message Visit poster's website
EddieA
PostPosted: Tue Feb 24, 2004 9:52 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

No, you could do it all in one node.
Code:
Get Cardinality
Loop through iterations
  Build Output tree, modifying as necessary
  PROPOGATE
End Loop

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
klabran
PostPosted: Tue Feb 24, 2004 12:24 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

So the following code snippet should create individual Citations that look like
<CITATION>
<CITINFO/>
<CHARGES>
<CHARGEINFO/>
</CHARGES>
</CITATION>

*********************************************************
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.

-- NOTE Headers or message not copied

DECLARE C INTEGER;
DECLARE D INTEGER;
DECLARE I INTEGER;
SET C = CARDINALITY(InputRoot.*[]);

/***********************************************************************************
* *
* Process CITATION Records - each CITATION-CHARGES is a seperate message *
* to IA0O.PROPAGATE.FULFILL Queue *
* *
************************************************************************************/

-- Loop through Citation Records to build individual citation messages
SET I = 1;
--Grab # of Citations in message...
WHILE I <= (SELECT COUNT(*) FROM InputBody."CITATIONS"."CITATION"[] AS CITNUM) DO

-- Propagate command deletes OutputRoot structure
-- need to copy Headers from incoming message for each output message

SET D = 1;
WHILE D < C DO
SET OutputRoot.*[D] = InputRoot.*[D];
SET D=D+1;
END WHILE;

-- Then build message body
SET "OutputRoot"."XML" = "InputRoot"."CITATIONS"."CITATION"[I];

-- Output message
SET OutputLocalEnvironment.Destination.MQ.DestinationData[1].queueName= 'IA0O.PROPAGATE.FULFILL';
PROPAGATE;

SET I = I + 1;
END WHILE;

-- Return false - no more messages. If this isnt done will get an extra 'empty' message written
RETURN FALSE;
******************************************************

I am getting empty messages in my Fulfill queue???
Back to top
View user's profile Send private message Visit poster's website
klabran
PostPosted: Tue Feb 24, 2004 12:47 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Nevermind.... I changed InputRoot to InputBody at the below line

SET "OutputRoot"."XML" = "InputRoot"."CITATIONS"."CITATION"[I];
TO
SET "OutputRoot"."XML" = "InputBody"."CITATIONS"."CITATION"[I];

and it works...

What is the difference between these two?

Man! Am I a rookie or what!
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Tue Feb 24, 2004 12:51 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

"InputBody" is shorthand for "InputRoot.*[LAST]". This usually resolves to the root of your parser - so "InputRoot.XML" or "InputRoot.MRM".
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
EddieA
PostPosted: Tue Feb 24, 2004 12:55 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
WHILE I <= (SELECT COUNT(*) FROM InputBody."CITATIONS"."CITATION"[] AS CITNUM) DO

This will work, but is inefficient. You should pull the value into a variable and use that instead.

"InputRoot"."XML" = "InputBody"

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Missam
PostPosted: Tue Feb 24, 2004 1:07 pm    Post subject: Reply with quote

Chevalier

Joined: 16 Oct 2003
Posts: 424

Finally you got it ..Cheers
Back to top
View user's profile Send private message
klabran
PostPosted: Tue Feb 24, 2004 2:06 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Thanks everyone for your help! It is greatly appreciated.

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Copy part of XML message
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.