Facing Problem while usinh XML as source in DataStage 7.5

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
shaonli
Participant
Posts: 80
Joined: Tue Nov 28, 2006 6:52 am

Facing Problem while usinh XML as source in DataStage 7.5

Post by shaonli »

I am developing a job where XML is used as a source.The traget table is RDBMS.
Now the XML source is containing the data like this:
<A>
<a>abc</a>
<b>123</b>
<c>q</c>
</A>
<B>
<d>2007</d>
<e>DP</e>
<f>-4</f>
</B>
<B>
<d>2006</d>
<e>DH</e>
<f>-3</f>
</B>
<B>
<d>2006</d>
<e>DJ</e>
<f>-2</f>
</B>

The columns are a,b,c,d,e,f

For a particular value of a,b,c the value of d,e,f are coming more than once.
So I need to populate this as 3 records in a table.
The metadata of XML file contains a,b,c,d,e,f columns.
So when I am running the job one record is inserted in table.
How can i populate 3 records in a table?

Please suggest.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Is this the actual whole document? How are abc and 123 defined? What elements do they belong to?

"assuming" that this document has normal header info, and that abc and 123 are strings that also belong to elements a and b as noted in the text, then the problem you will have is that d, e, and f are not collected into a single element construct. Could be it's just a poor design. Usually you would see something like:

<repeatingStuff>
<d>2007</d>
<e>DP</e>
<f>-4</f>
</repeatingStuff>

-or-

<repeatingStuff>
<oneInstance>
<d>2007</d>
<e>DP</e>
<f>-4</f>
</oneInstance>
<oneInstance>
...and so forth...
</oneInstance>
</repeatingStuff>


...as a wrapping around each of those groups...and then the XMLInput Stage would pick it up more easily. If the documents aren't too big, you might consider playing with something like I've proposed in a sample, and then using DS to "zap" the elements into it that you require, or do some global changing external to DS before reading. Not a great idea if the documents are enormous though.

Ernie
Post Reply