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 » Need help on ROW datatype

Post new topic  Reply to topic
 Need help on ROW datatype « View previous topic :: View next topic » 
Author Message
anilmekala
PostPosted: Mon Oct 06, 2014 5:37 am    Post subject: Need help on ROW datatype Reply with quote

Acolyte

Joined: 19 Oct 2012
Posts: 63

Hi All,

I hope all are doing good.

I am receiving xml from external system as below format

<MRequest>
<Mab>
<Hab>
<Type>ABC</Type>
<Npices>10</Npices>
<Ref>120</Ref>
</Hab>
<Hab>
<Type>ABC</Type>
<Npices>10</Npices>
<Ref>120</Ref>
</Hab>
<Hab>
<Type>ABC</Type>
<Npices>10</Npices>
<Ref>121</Ref>
</Hab>
<Hab>
<Type>ABC</Type>
<Npices>10</Npices>
<Ref>130</Ref>
</Hab>
<Hab>
<Type>XYZ</Type>
<Npices>10</Npices>
<Ref>125</Ref>
</Hab>
</Mab>
</MRequest>


My requirment is i need check type ='ABC' need iterate each Hab element
if get same ref in iteration need to update npice else i need to added to new row datatype

I am pasting code snipet as below update check is not happening.

DECLARE tempDngGdsCnt ROW;
DECLARE intTempRow INTEGER;
DECLARE npcs INTEGER;
DECLARE shipref CHARACTER;
DECLARE intShipRef INTEGER;
DECLARE intShipStmt INTEGER;
SET intTempHawbVal=1;
SET intShipStmt = 1;
WHILE LASTMOVE(refToHawb) DO
IF(refToHawb.ShipperRef.Qualifier='DGS')THEN
SET npcs = CAST(SUBSTRING(refToHawb.NumberOfPieces BEFORE '/') AS INTEGER);
SET shipref = refToHawb.ShipperRef.ShipmentRef;
SET intShipRef =CARDINALITY(tempDngGdsCnt.shipref[]);
DECLARE bolExist BOOLEAN FALSE;

PROCESS1: WHILE (intShipStmt<=intShipRef) DO
IF tempDngGdsCnt.shipref[intShipRef].value = shipref THEN
SET tempDngGdsCnt.shipref[intShipRef].Value = shipref;
SET tempDngGdsCnt.npcs[intShipRef].Value = CAST(tempDngGdsCnt.npcs[intShipRef].Value AS INTEGER)+npcs;
SET bolExist = TRUE;
LEAVE PROCESS1;
END IF;
SET intShipStmt= intShipStmt+1;
END WHILE;

IF NOT bolExist THEN
SET intShipRef = intShipRef + 1;
SET tempDngGdsCnt.shipref[intShipRef].Value = shipref;
SET tempDngGdsCnt.npcs[intShipRef].Value = npcs;
END IF;
END IF;
SET intTempHawbVal = intTempHawbVal+1;
MOVE refToHawb NEXTSIBLING REPEAT TYPE NAME;
END WHILE;


Please help me on the above.

Thank you
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Oct 06, 2014 5:44 am    Post subject: Re: Need help on ROW datatype Reply with quote

Grand High Poobah

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

anilmekala wrote:
I am pasting code snipet as below update check is not happening.


Well, if you'd used c o d e tags it would be easier for everyone to read, including you. Then you might have seen:

Code:
IF tempDngGdsCnt.shipref[intShipRef].value = shipref THEN
SET tempDngGdsCnt.shipref[intShipRef].Value = shipref;
SET tempDngGdsCnt.npcs[intShipRef].Value = CAST(tempDngGdsCnt.npcs[intShipRef].Value AS INTEGER)+npcs;   
SET bolExist = TRUE;
LEAVE PROCESS1;
END IF;


The IF tests for value but the code sets Value.

By the way, never use indexes for this kind of thing; horribly inefficient. Use references.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Oct 06, 2014 5:47 am    Post subject: Reply with quote

Grand High Poobah

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

Or better still use a SELECT to identify all the type=ABC and process them as a block.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Need help on ROW datatype
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.