XML Output stage repeats element

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
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

I haven't seen this in awhile. Noticed it most often when there are very few columns in the sub-columns of the repeating node.

Try this: Add a dummy column that is 100% unique (use something like @INROWNUM upstream)...put this dummy column just above ProdCode in the link and give it xpath (the Description property) that looks just like ProdCode but with /dummy/text() at the end instead of ProdCode/text().

See if that produces the xml that you need....of course, it will have an extra element called "dummy".......put an output link on your xmlOutput Stage with a single large varchar column and a single '/' in the Description property. Send that to a Transformer or other means for removing the dummy element.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
pnpmarques
Participant
Posts: 35
Joined: Wed Jun 15, 2005 9:27 am

Post by pnpmarques »

I realized a pattern that is related to the order how input records are processed:
If "identic" elements are processed sequentially, i.e., one right after another, then Datastage "aggregates" them inadequately.
If by chance they are not processed sequentially then xml is created as intended.

About your suggestion, I am not a fan of that solution but I guess Datastage was not born to deal perfectly with xml. Anyway we tried and it worked, introducing a unique dummy element and then removing it is our workaround at the moment.
Our choice to remove dummy elements was to use unix AWK command (SED is slower). For those who might be interested, it should be something like this:
awk '{a=$0;gsub("<DUMMYID>[0-9]*</DUMMYID>","",a);print a}' INPUTFILE.xml > OUTFILE.xml

Thank you.
Jayakannan
Participant
Posts: 73
Joined: Wed Sep 30, 2009 5:20 am

Post by Jayakannan »

Which one is the key column in XML Output stage under Input->Columns tab?
Regards,
Kannan
pnpmarques
Participant
Posts: 35
Joined: Wed Jun 15, 2005 9:27 am

Post by pnpmarques »

I have 2 columns defined as Key, a functional column(like ProdCod) and the new dummy column, but I guess dummy should be enough.
Jayakannan
Participant
Posts: 73
Joined: Wed Sep 30, 2009 5:20 am

Post by Jayakannan »

Desc as key column in Input->Columns' tab of XML Output stage should work.
Regards,
Kannan
Post Reply