XML Output

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ccormack
Participant
Posts: 6
Joined: Fri Aug 27, 2004 2:11 am
Location: London

XML Output

Post by ccormack »

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
garthmac
Charter Member
Charter Member
Posts: 55
Joined: Tue Oct 21, 2003 9:17 am
Location: UK

Post by garthmac »

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...
ccormack
Participant
Posts: 6
Joined: Fri Aug 27, 2004 2:11 am
Location: London

XML Output

Post by ccormack »

garthmac wrote:... Have you contacted Ascential about this? I would be interested in the outcome...
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.

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.
garthmac
Charter Member
Charter Member
Posts: 55
Joined: Tue Oct 21, 2003 9:17 am
Location: UK

Post by garthmac »

Excellent, I'm glad you solved your problem!
Post Reply