How to filter XML records

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
rajudx
Participant
Posts: 45
Joined: Tue Nov 14, 2006 1:58 pm
Location: NJ

How to filter XML records

Post by rajudx »

As per the requirement need to read one of the XML file and separate same XML records into another file based on lookup file.

Input
<Mid> 230 </Mid>
<Memname>Frank</Memname>
<Memaddr>123 Ave Raod</Memaddr>
<Memphone>234908789 </Memphone>

<Mid> 130 </Mid>
<Memname>James</Memname>
<Memaddr>6780 Old Traf Road</Memaddr>
<Memphone>567123490</Memphone>

<Mid> 330 </Mid>
<Memname>Tawan</Memname>
<Memaddr>789 Dogules Road</Memaddr>
<Memphone>3458902567 </Memphone>

<Mid> 430 </Mid>
<Memname></Memname>
<Memaddr>4560 North Ave Road</Memaddr>
<Memphone>3412345690 </Memphone>

Lookup File->MID (330,230)

Out put .xml

<Mid> 330 </Mid>
<Memname>Tawan</Memname>
<Memaddr>789 Dogules Road</Memaddr>
<Memphone>3458902567 </Memphone>

<Mid> 230 </Mid>
<Memname>Frank</Memname>
<Memaddr>123 Ave Raod</Memaddr>
<Memphone>234908789 </Memphone>

Right now XML file reading through External source stage->XML input file-Dataset.

Please let me know how to filter XML records based on lookup value and create XML file same format.
Ran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What have you tried?

We're really here to help you to develop your skills, rather than to provide solutions. (Some of us are in business doing the latter, but that doesn't count in this discussion.)

So please post any analysis you may have done of the problem (apart from "ask DSXchage how to do my work") and any solution you may have attempted, together with the result thereof.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Take XML out of the picture, it isn't really relevant here. You have a stream of records coming in and a lookup to do and you only want to pass records through to the target where the lookup succeeds. That should help. Then the result can either be written out to a dataset as you show currently or use an XML Output stage to take the flattened row and convert it back to XML.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply