Hello!
I have a problem with the XML Writer in Datastage 5.x that I hope somebody can help me with. I am writing out records in an un-sorted order from a hash file to an xml file.
Each record must transformed into the following:
<instrument>
</instrument>
<ownership>
</ownership>
<underlying-stocks>
</underlying-stocks>
I have this working perfectly except in the case where two records lie sequentially together and where the instrument details are the same . It should write out those records like so:
<instrument>
... record 1 instrument details
</instrument>
<ownership>
... record 1 instrument ownership details
</ownership>
<underlying-stocks>
... record 1 instrument underlying-stocks details
</underlying-stocks>
<instrument>
... record 2 instrument details
</instrument>
<ownership>
... record 2 instrument ownership details
</ownership>
<underlying-stocks>
... record 2 instrument underlying-stocks details
</underlying-stocks>
However what it actually does is this:
<instrument>
... record 1 instrument details
</instrument>
<ownership>
... record 1 instrument ownership details
</ownership>
<underlying-stocks>
... record 1 instrument underlying-stocks details
</underlying-stocks>
<ownership>
... record 2 instrument ownership details
</ownership>
<underlying-stocks>
... record 2 instrument underlying-stocks details
</underlying-stocks>
I think this is because record 1 instrument details are the same as record 2 instrument details. I'm not sure how to get around this as the logic seems to be in the "black box" of the XML Writer stage.
Can anyone shed some light?
Many thanks,
Chris
XML Output
Moderators: chulett, rschirm, roy
I had a similar problem, but never resolved it. I was going to contact Ascential support about it, but a business decision was made to not use XML to move data around on the project I was working on, so my problem was left unresolved.
Have you contacted Ascential about this? I would be interested in the outcome...
Have you contacted Ascential about this? I would be interested in the outcome...
XML Output
Yes, I contacted Ascential Support who have in the main been very helpful in identifying the problem and providing a workaround solution. The problem lies in the way the XML Writer stage works out when to "trigger" output. I believe that XML Pack 2 allows more user-control in this area but the XML Pack (1) that I am using has no control.garthmac wrote:... Have you contacted Ascential about this? I would be interested in the outcome...
By outputting @OUTROWNUM as a dummy-id in the <instrument> element we assume control by "fooling" the XML Writer into thinking the instrument details have changed for each output row. Of course, we have to filter the <dummy-id> elements out after the file is produced but that's pretty simple.
:D
C.