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 » Propagate Question

Post new topic  Reply to topic
 Propagate Question « View previous topic :: View next topic » 
Author Message
yolandav
PostPosted: Wed May 19, 2010 2:09 am    Post subject: Propagate Question Reply with quote

Newbie

Joined: 18 May 2010
Posts: 4

Hi all
I have the following input message, that i need to progate to two message using the propagate statement.

Code:
<GuaranteePayawayInstruction>
 <originating system="LOL" />
 <timestamp year="2010" month="04" day="16" hour="13" minute="47" second="27" />
 <actiondate year="2010" month="04" day="30" />
 <PaymentDetail>
  <clientaccount>
   <branch>00000</branch>
   <account>23223232233</account>
   <name>Black White</name>
   <reference>ddididid</reference>
   <equation-account-number>123123123</equation-account-number>
  </clientaccount>
  <beneficiaries>
  <beneficiary>
    <amount>100.00</amount>
    <payment_reference>123322323</payment_reference>
    <branch>1111</branch>
    <account_number>111</account_number>
    <account_name>Account1</account_name>
    <client_reference>Refrnce1</client_reference>
   </beneficiary>
   <beneficiary>
    <amount>2000.00</amount>
    <payment_reference>123123232</payment_reference>
    <branch>11111</branch>
    <account_number>222</account_number>
    <account_name>Account2</account_name>
    <client_reference>Refrnce2</client_reference>
   </beneficiary>
  </beneficiaries>
 </PaymentDetail>
</GuaranteePayawayInstruction>

Here is my code:
DECLARE COUNT INTEGER 1;
DECLARE List INTEGER CARDINALITY(InputRoot.XMLNSC.GuaranteePayawayInstruction.PaymentDetail.beneficiaries.beneficiary[]);
       DECLARE List_2  REFERENCE TO InputRoot.XMLNSC.GuaranteePayawayInstruction.PaymentDetail.beneficiaries.beneficiary[1];
WHILE COUNT <= List  DO

Then the rest of the ESQL code...
The code that follows, moves to the next beneficiary in the input message

MOVE List_2 TO InputRoot.XMLNSC.GuaranteePayawayInstruction.PaymentDetail.beneficiaries.beneficiary[COUNT];
SET OutputRoot.XMLNSC.IntegrationMessage.Operation.GuaranteePayawayInstruction.PaymentDetail.beneficiary[COUNT].amount = List_2.amount;
         SET OutputRoot.XMLNSC.IntegrationMessage.Operation.GuaranteePayawayInstruction.PaymentDetail.beneficiary[COUNT].payment_reference = List_2.payment_reference;
         SET OutputRoot.XMLNSC.IntegrationMessage.Operation.GuaranteePayawayInstruction.PaymentDetail.beneficiary[COUNT].branch = List_2.branch;
         SET OutputRoot.XMLNSC.IntegrationMessage.Operation.GuaranteePayawayInstruction.PaymentDetail.beneficiary[COUNT].account_number = List_2.account_number;
         SET OutputRoot.XMLNSC.IntegrationMessage.Operation.GuaranteePayawayInstruction.PaymentDetail.beneficiary[COUNT].account_name = List_2.account_name;
         SET OutputRoot.XMLNSC.IntegrationMessage.Operation.GuaranteePayawayInstruction.PaymentDetail.beneficiary[COUNT].client_reference = List_2.client_reference;

PROPAGATE;
SET COUNT = COUNT + 1;
END WHILE;

END;
END MODULE;

My problem is OUTPUT Message2:  the message is returning two beneficiary tags instead of one i.e <beneficiary></beneficiary>.

OUTPUT Message1:
----------------------
<IntegrationMessage Version="1.0" System="HelloJOE"><Operation><Opname>RouteMessage</Opname><RoutingData><originating system="LOL"/><message topic="GuaranteeInstruction"/><destination></destination><adapter>N/A</adapter><host>N/A</host><source></source>
<manage>N/A</manage>
<messageid>12212111111111223#######</messageid></RoutingData><GuaranteePayawayInstruction topic="LOL"><timestamp year="2010" month="04" day="16" hour="14" minute="33" second="36"/><actiondate year="2010" month="04" day="30"/><PaymentDetail><clientaccount><branch>111</branch><account>1212123123123</account><name>Black White</name><reference> Black White</reference><equation-account-number>5555555</equation-account-number></clientaccount><beneficiary><amount>100.00</amount>
<payment_reference>111111</payment_reference><branch>1111</branch><account_number>11111</account_number>
<account_name>Account1</account_name><client_reference>Refrnce1</client_reference></beneficiary></PaymentDetail></GuaranteePayawayInstruction>
</Operation></IntegrationMessage>


OUTPUT Message2:
----------------------
<IntegrationMessage Version="1.0" System="HelloJOE"><Operation><Opname>RouteMessage</Opname><RoutingData><originating system="LOL"/><message topic="GuaranteeInstruction"/><destination></destination><adapter>N/A</adapter><host>N/A</host><source></source><manage>N/A</manage>
<messageid>12212111111111223#######</messageid></RoutingData><GuaranteePayawayInstruction topic="LOL"><timestamp year="2010" month="04" day="16" hour="14" minute="33" second="36"/><actiondate year="2010" month="04" day="30"/><PaymentDetail><clientaccount><branch>111</branch><account>1212123123123</account><name>Black White</name><reference> Black White</reference><equation-account-number>5555555</equation-account-number></clientaccount>
<beneficiary></beneficiary><beneficiary><amount>2000.00</amount><payment_reference>2222</payment_reference>
<branch>2222</branch><account_number>2222</account_number><account_name>Account2</account_name>
<client_reference>Refrnce2</client_reference></beneficiary></PaymentDetail></GuaranteePayawayInstruction></Operation>
</IntegrationMessage>


Can anyone help me, I'm not sure what I'm doing wrong here.

Thanks
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed May 19, 2010 5:14 am    Post subject: Reply with quote

Grand High Poobah

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

The first thing you're doing wrong is not posting code inside the code tags on the forum which makes it very hard to read! If you'd be so good in future posts it helps those of us of increasing age and diminishing eyesight...

Secondly you're mixing methods. Don't use CARDINALITY (ever - for reasons discussed on this forum in the past) with references. Have another look at how you're doing that.

Thirdly when faced with this sort of problem always take a user trace. This will show you what the broker is doing and specifically in your case the output trees being built. This in 99% of cases offers a clue.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
yolandav
PostPosted: Thu May 20, 2010 6:07 am    Post subject: Reply with quote

Newbie

Joined: 18 May 2010
Posts: 4

Hi Vitor

Sorry but I'm new in this forum, I can't say I've come across responses that deal with CARDINALITY and REFERENCES.

So if I can't use CARDINALITY with REFERENCE how else can I move to the next element without REFERENCE?

Is MOVE NEXT statement the next best solution...?


Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Thu May 20, 2010 6:13 am    Post subject: Reply with quote

Grand High Poobah

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

yolandav wrote:
Sorry but I'm new in this forum, I can't say I've come across responses that deal with CARDINALITY and REFERENCES.


The Search Function Is Your Friend.

yolandav wrote:
Is MOVE NEXT statement the next best solution...?


It's the best solution.

To sumarise a lot of discussion: if you use CARDINALITY and tell the broker to access the nth element it counts from one each time. Not so much a problem in your scenario when you have 2 elements, but if you have 100 you'll notice a serious performance hit when you get to element 98 by parsing over 97 elements you've already read, then get to 99 by parsing over 97 already processed elements.

As I said, not so much a problem with 2 (providing you keep them separate) but it's called best practice for a reason.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
yolandav
PostPosted: Mon May 24, 2010 1:06 am    Post subject: Reply with quote

Newbie

Joined: 18 May 2010
Posts: 4

Hey Vitor, thanx for your help....

The MOVE NEXt statement worked...

I Declared a variable that ReferenceTo InputRoot, I then used the WHILE...LOOP, then PROPAGATED the first message. To MOVE to the next beneficiary I used the MOVE NEXTSIBLING statement... Then when it found it, PROPAGATED the next message and exited the LOOP with the RETURN FALSE;

Thanx lot!!!!!
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 » Propagate Question
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.