Repeating elements in XML Output Stage

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
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Repeating elements in XML Output Stage

Post by just4geeks »

Just wondering if someone can help me with this.

I have this in a flat file.

Code: Select all

020902,020902001,1200110100Z001
020902,020902001,1200110100Z002
The XML schema is this,

Code: Select all

/ORG/CLASS/ITEM/text()
/ORG/PROG/ITEM/text()
/ORG/LINE/LINECODE/ID/text()
Expected output:

Code: Select all

<ORG>
 <CLASS>
  <ITEM>020902</ITEM>
 </CLASS>
 <PROG>
  <ITEM>020902001</ITEM>
 </PROG>
  <LINE>
  <LINECODE IdentificationSystem="VA">
   <ID>1200110100Z001</ID>
  </LINECODE>
 </LINE>
 <LINE>
  <LINECODE IdentificationSystem="VA">
   <ID>1200110100Z002</ID>
  </LINECODE>
 </LINE>
 </ORG>
But what I get is, this. The ORG tags are repeating. How do I make it not repeat for every new /ORG/LINE/LINECODE/ID.

Code: Select all

<ORG>
 <CLASS>
  <ITEM>020902</ITEM>
 </CLASS>
 <PROG>
  <ITEM>020902001</ITEM>
 </PROG>
 <LINE>
  <LINECODE IdentificationSystem="VA">
   <ID>1200110100Z001</ID>
  </LINECODE>
 </LINE>
</ORG>
<ORG>
 <CLASS>
  <ITEM>020902</ITEM>
 </CLASS>
 <PROG>
  <ITEM>020902001</ITEM>
 </PROG>
 <LINE>
  <LINECODE IdentificationSystem="VA">
   <ID>1200110100Z002</ID>
  </LINECODE>
 </LINE>
</ORG>
Any ideas are welcome.
Attitude is everything....
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

Which column[Xpath] have you tagged as the key column of XML output stage ? It should be the ID tag
prasannakumarkk
Participant
Posts: 117
Joined: Wed Feb 06, 2013 9:24 am
Location: Chennai,TN, India

Post by prasannakumarkk »

What is the option you have checked?
1) Aggregate rows
2) Single Row
3) Key column
Thanks,
Prasanna
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

rameshrr3 wrote:Which column[Xpath] have you tagged as the key column of XML output stage ? It should be the ID tag
When I set the ID tag as the key, it appears to work fine until I have two instances of /ORG/PROG/ITEM/text()

Code: Select all

020902,[b]020902001[/b],1200110100Z001 
020902,[b]020902002[/b],1200110100Z002
This is the output I get,
<ORG>
<CLASS>
<ITEM>020902</ITEM>
</CLASS>
<PROG>
<ITEM>020902001</ITEM>
</PROG>
<LINE>
<LINECODE IdentificationSystem="VA">
<ID>1200110100Z001</ID>
<ID>1200110100Z002</ID>
</LINECODE>
</LINE>
</ORG>
<ORG>
<CLASS>
<ITEM>020902</ITEM>
</CLASS>
<PROG>
<ITEM>020902002</ITEM>
</PROG>
<LINE>
<LINECODE IdentificationSystem="VA">
<ID>1200110100Z001</ID>
<ID>1200110100Z002</ID>
</LINECODE>
</LINE>
</ORG>
Last edited by just4geeks on Fri Mar 08, 2013 7:12 am, edited 1 time in total.
Attitude is everything....
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

prasannakumarkk wrote:What is the option you have checked?
1) Aggregate rows
2) Single Row
3) Key column
Aggregate rows.
Attitude is everything....
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

It's not exactly clear to me what you "want" to get, or what the exact issue is. Can you provide a bit more detail and explanation?

Thanks.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

eostic wrote:Can you provide a bit more detail and explanation?
Hi Ernie, I agree I wasn't elaborate on my question. Fortunately, this question isn't relevant anymore due to job design changes and I have been confronted with another similar yet perplexing XML problem. I will be posting the question in a new thread.

Update:
The new thread is here viewtopic.php?p=437969
Attitude is everything....
Post Reply