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 » LASTMOVE - HOW TO USE

Post new topic  Reply to topic
 LASTMOVE - HOW TO USE « View previous topic :: View next topic » 
Author Message
v_venugopalan
PostPosted: Sat Dec 06, 2003 12:20 am    Post subject: LASTMOVE - HOW TO USE Reply with quote

Novice

Joined: 25 Nov 2003
Posts: 12
Location: INDIA

Hi PPL,

i need a small help regarding usage of LastMove
im using WMQI 2.1

My Input Xml Looks Like Something like This
Quote:


<Data>
<Table>Employee</Table>
</Data>
<Data>
<Table>Person</Table>
</Data>
<Data>
<Table>Custom</Table>
</Data>
<Data>
<Table>Rubber</Table>
</Data> ........



I basically want to loop through all occurances of DATA tag

and need the output Like
Quote:


<Employee>Employee</Employee>
<Person>Person</Person>
<Custom>Custom</Custom>
<Rubber>Rubber</Rubber>.... and so on


My code for Transformation looks somethin likes this

Quote:

DECLARE newPath CHARACTER;
DECLARE myref REFERENCE TO InputBody.DATA;
WHILE LASTMOVE(myref)=TRUE DO
SET newPath = myref.Table;
EVAL('SET OutputRoot.XML.DATA.' || newPath || ' = newPath');
MOVE myref NEXTSIBLING;
END WHILE;


But it works only for the First Instance and Not For Other Instances

also if i change my code like this
Quote:

WHILE LASTMOVE(myref)=TRUE DO
SET newPath = myref.Table;
EVAL('SET OutputRoot.XML.DATA.' || newPath || ' = newPath');
SET myref=myref+1;
MOVE myref NEXTSIBLING;
END WHILE;


It Says " Invalid Field Reference " Error..

Can Anyone tell me how i can modify my code to refer to subsequent instances of <DATA> and get the Output

I also Used cardinality Function But in Vain... If LastMove will not work here, how to use CARDINALITY to acheive my Transformation

TX
_________________
VV
Back to top
View user's profile Send private message
EddieA
PostPosted: Sat Dec 06, 2003 8:11 pm    Post subject: Reply with quote

Jedi

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

Try:

Code:
WHILE LASTMOVE(myref) DO


That's how my code using LASTMOVE is set up.

Also, is that XML actually 'legal'. There isn't a single 'Top level' tag.

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 Dec 09, 2003 8:05 am    Post subject: Reply with quote

Chevalier

Joined: 16 Oct 2003
Posts: 424

Hi,
First of all the Input XML you have given is not a valid XML.A valid XML should contain only one root element.Lets think the input XML is like this
Quote:

<Record>
<Data>
<Table>Employee</Table>
</Data>
<Data>
<Table>Person</Table>
</Data>
<Data>
<Table>Custom</Table>
</Data>
<Data>
<Table>Rubber</Table>
</Data>
</Record>

And you have problem with
WHILE LASTMOVE(myref) = TRUE DO
if you want to check the LASTMOVE..first you have to move your myref to desired element as i shown below
Quote:

Declare newPath Character;
DECLARE index Integer;
SET index = 1;
DECLARE myref REFERENCE TO InputBody.Record.Data[1];
DECLARE outref REFERENCE TO OutputRoot.XML.Record;
MOVE myref TO InputBody.Record.Data[1];
WHILE LASTMOVE(myref) = TRUE DO
SET newPath = InputBody.Record.Data[index].Table;

EVAL('SET OutputRoot.XML.Record.' || newPath || ' = ' || ' newPath ');
SET index = index + 1;
MOVE myref TO InputBody.Record.Data[index];
END WHILE;

Hope the above code for compute node works for you
Thanx
Sam
Back to top
View user's profile Send private message
v_venugopalan
PostPosted: Fri Dec 12, 2003 8:20 am    Post subject: Reply with quote

Novice

Joined: 25 Nov 2003
Posts: 12
Location: INDIA

Tx Sam That worked.........
_________________
VV
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 » LASTMOVE - HOW TO USE
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.