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 » how to build inner loop for FOR condition

Post new topic  Reply to topic
 how to build inner loop for FOR condition « View previous topic :: View next topic » 
Author Message
mr2kn
PostPosted: Mon Aug 15, 2016 9:13 am    Post subject: how to build inner loop for FOR condition Reply with quote

Apprentice

Joined: 26 Jan 2016
Posts: 46

Hi,
Thank you for seeing my request

in IIB9 im using the For condition and again For condition to achieve multiple response from the single response, example which I want to be

<ExternalPendingPayments transactionId="0">
<Status>Pending</Status>
<ScheduleType>4</ScheduleType>
<SendDate>2016-08-17T00:00:00.000Z</SendDate>
<AccountInfo>
<FromCFI>7722</FromCFI>
<FromNumber>000579793</FromNumber>
<FromType>Checking</FromType>
</AccountInfo>
<Amount>1.50</Amount>
<FrequencyId>1</FrequencyId>
<SenderName>MARY GRAF</SenderName>
<ReceiverName>Nikhil Agrawal</ReceiverName>
</ExternalPendingPayments>
[/code]
like this it will 12 be times with changing only send dates and amount

After this it should go next record response and samething need to proceed to construct and it will become 24 times and etc for next recurring

and response I will get from the vendor like this sample
Code:

<ScheduledAndRecurringPaymentsList>
  <FromAccountDetails>
      <AccountCFIID>7722</AccountCFIID>
      <AccountNumber>000579793</AccountNumber>
   <DetailTransfersList>
      <Transfer>
         <Amount><Value>1.50</Value></Amount>   
         <SendDate><Value>08/17/2016</Value></SendDate>
      </Transfer>
      <Transfer>
         <Amount><Value>1.50</Value></Amount>   
         <SendDate><Value>09/17/2016</Value></SendDate>
      </Transfer>
      <Transfer>
         <Amount><Value>1.50</Value></Amount>   
         <SendDate><Value>10/17/2016</Value></SendDate>
      </Transfer>
   </DetailTransfersList>
</ScheduledAndRecurringPaymentsList>
<ScheduledAndRecurringPaymentsList>
  <FromAccountDetails>
      <AccountCFIID>7722</AccountCFIID>
      <AccountNumber>000579793</AccountNumber>
   <DetailTransfersList>
      <Transfer>
         <Amount><Value>56.0</Value></Amount>   
         <SendDate><Value>08/17/2016</Value></SendDate>
      </Transfer>
      <Transfer>
        <Amount><Value>56.0</Value></Amount>   
         <SendDate><Value>09/17/2016</Value></SendDate>
      </Transfer>
      <Transfer>
         <Amount><Value>56.0</Value></Amount>   
         <SendDate><Value>10/17/2016</Value></SendDate>
      </Transfer>
   </DetailTransfersList>
</ScheduledAndRecurringPaymentsList>




so for this I have written the code like this but for 1 loop it will come correctly and next loop it will not go into DetailTransferlist >Transfer loop since its having the multiple

Code:

FOR z AS InputRoot.SOAP.Body.return.ScheduledAndRecurringPaymentsList[] DO
FOR z1 AS InputRoot.SOAP.Body.return.ScheduledAndRecurringPaymentsList.DetailTransfersList.Transfer[] DO

SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ExternalPendingPaymentResult.ExternalPendingPayments[res21].(XMLNSC.Attribute)transactionId = InputRoot.SOAP.Body.return.ScheduledAndRecurringPaymentsList.DetailTransfersList.Transfer[res21].TransactionId;
            SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ExternalPendingPaymentResult.ExternalPendingPayments[res21].Status = InputRoot.SOAP.Body.return.ScheduledAndRecurringPaymentsList.DetailTransfersList.Transfer[res21].TransferStatus;
            SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ExternalPendingPaymentResult.ExternalPendingPayments[res21].ScheduleType = InputRoot.SOAP.Body.return.ScheduledAndRecurringPaymentsList.ScheduleTypeId;
            SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ExternalPendingPaymentResult.ExternalPendingPayments[res21].SendDate = CAST(CAST(InputRoot.SOAP.Body.return.ScheduledAndRecurringPaymentsList.DetailTransfersList.Transfer[res21].SendDate.Value AS DATE FORMAT 'MM/dd/yyyy') AS CHARACTER FORMAT 'yyyy-MM-dd''T''HH:mm:ss.SSS''Z');
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ExternalPendingPaymentResult.ExternalPendingPayments[res21].Amount = InputRoot.SOAP.Body.return.ScheduledAndRecurringPaymentsList.DetailTransfersList.Transfer[res21].Amount.Value;
SET res21 = res21 + 1;
END FOR;
SET res2 = res2 + 1;
END FOR;


Please help where Im doing wrong
Thank you and Appreciate your help,
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Aug 15, 2016 9:29 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You're not using your z and z1 references, at a start.

You also aren't showing where you "achieve multiple response from the single response".
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
mr2kn
PostPosted: Mon Aug 15, 2016 10:19 am    Post subject: Reply with quote

Apprentice

Joined: 26 Jan 2016
Posts: 46

now I have used the z and z1 references, in the code

in the starting I mentioned the responses which I need to have the multiple response like this from the single response
and only the send date and amount will changing

Code:

<ExternalPendingPayments transactionId="0">
 <Status>Pending</Status>
 <ScheduleType>4</ScheduleType>
<SendDate>2016-08-17T00:00:00.000Z</SendDate>
 <AccountInfo>
 <FromCFI>7722</FromCFI>
 <FromNumber>000579793</FromNumber>
 <FromType>Checking</FromType>
 </AccountInfo>
<Amount>1.50</Amount>
 <FrequencyId>1</FrequencyId>
 <SenderName>MARY GRAF</SenderName>
 <ReceiverName>Nikhil Agrawal</ReceiverName>
 </ExternalPendingPayments>

<ExternalPendingPayments transactionId="0">
 <Status>Pending</Status>
 <ScheduleType>4</ScheduleType>
<SendDate>2016-09-17T00:00:00.000Z</SendDate>
 <AccountInfo>
 <FromCFI>7722</FromCFI>
 <FromNumber>000579793</FromNumber>
 <FromType>Checking</FromType>
 </AccountInfo>
<Amount>1.50</Amount>
 <FrequencyId>1</FrequencyId>
 <SenderName>MARY GRAF</SenderName>
 <ReceiverName>Nikhil Agrawal</ReceiverName>
 </ExternalPendingPayments><ExternalPendingPayments transactionId="0">
 <Status>Pending</Status>
 <ScheduleType>4</ScheduleType>
<SendDate>2016-10-17T00:00:00.000Z</SendDate>
 <AccountInfo>
 <FromCFI>7722</FromCFI>
 <FromNumber>000579793</FromNumber>
 <FromType>Checking</FromType>
 </AccountInfo>
<Amount>1.50</Amount>
 <FrequencyId>1</FrequencyId>
 <SenderName>MARY GRAF</SenderName>
 <ReceiverName>Nikhil Agrawal</ReceiverName>
 </ExternalPendingPayments><ExternalPendingPayments transactionId="0">
 <Status>Pending</Status>
 <ScheduleType>4</ScheduleType>
<SendDate>2016-11-17T00:00:00.000Z</SendDate>
 <AccountInfo>
 <FromCFI>7722</FromCFI>
 <FromNumber>000579793</FromNumber>
 <FromType>Checking</FromType>
 </AccountInfo>
<Amount>1.50</Amount>
 <FrequencyId>1</FrequencyId>
 <SenderName>MARY GRAF</SenderName>
 <ReceiverName>Nikhil Agrawal</ReceiverName>
 </ExternalPendingPayments>


hope this helps to understand and to know the solution/comments
Thank you once again
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Aug 15, 2016 10:28 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I still don't know what you mean by
Quote:
the multiple response like this from the single response


An IIB flow can send out as many messages from a single input as you want it to.

A SOAP call expects exactly one response to each request.

An XML message can only have one root element.

The root element of an XML message can have as many direct children as you want.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
mr2kn
PostPosted: Mon Aug 15, 2016 10:37 am    Post subject: Reply with quote

Apprentice

Joined: 26 Jan 2016
Posts: 46

I mean to say I will get single response from that I need to construct into multiple elements in the required format
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Aug 15, 2016 10:47 am    Post subject: Reply with quote

Grand High Poobah

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

mr2kn wrote:
I mean to say I will get single response from that I need to construct into multiple elements in the required format


I still don't understand that any more than my most worthy associate understood it before.

So you get a single XML response. You want to send multiple elements - do you mean more XML stanzas than are in the original response? Do you mean multiple XML documents (each with a root tag of ExternalPendingPayments) in response?

All of this is possible with IIB. The only thing which is impossible (as my most worthy associate correctly points out) is a single document with multiple root ExternalPendingPayments root tags. That's not well formed XML and nothing to do with IIB.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Aug 15, 2016 11:13 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If you want to create a single XML document with several ExternalPendingPayments elements, then you simply need to write your code to do that.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
timber
PostPosted: Mon Aug 15, 2016 12:08 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

I have looked carefully at your questions. Thank you for trying to make the code and XML readable by using [c o d e] tags.

Please tell me if the following statements are true.
1. You are receiving an XML message from the 'vendor'. The message contains multiple 'ScheduledAndRecurringPaymentsList tags.
2. Each ScheduledAndRecurringPaymentsList tag contains one FromAccountDetails and multiple pairs of date/amount.
3. You need to generate a SOAP message which contains multiple ExternalPendingPayments tags. Each one will contain a copy of the data in the FromAcountDetails tag.

In other words, the output XML repeats itself a lot, but the XML format does not. You need to map from the compact input XML to the verbose output XML.

Please correct any misunderstandings in the above. After that, we may be able to offer some advice on your ESQL coding.
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 » how to build inner loop for FOR condition
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.