XML files Creation dynamically

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
srikan3
Participant
Posts: 4
Joined: Tue May 17, 2016 7:44 am
Location: Hyderbad

XML files Creation dynamically

Post by srikan3 »

Hi All,

Here is my requirement, it will be great help if someone can help me in my current XML requirement.

We need generate XML files from source DB2 database. We have more than 2000 different tables. We just need to extract data from DB2 tables and generate each XML for each table.

I have XSD file for each table.

Can we do it in single job ?
Sri
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Possibly.... consider using the xml Transformer.....and then, based on the table you are extracting, dynamically build the Stylesheet for xslt that will craft the xml you desire for that particular table....

Not easy...you have to work out the stylesheet yourself and figure out how to generate it...but you can pass the name of that stylesheet dynamically, and also, often when converting rdbms to xml, there is a fairly simple and consistent format.

The actual stages for building formal xml (xmlOutput and Hierarchical Stage [or xml stage depending on your release]) require fixed and compiled metadata for the xml schema you are writing for.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
srikan3
Participant
Posts: 4
Joined: Tue May 17, 2016 7:44 am
Location: Hyderbad

For XML transformer stage do we need XML as INPUT ?

Post by srikan3 »

Thanks Ostic for the reply, but for XML transformer stage we need to give "XML source column", how we will give this source column name.

Can anyone else resolve my problem ?
Sri
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There are many options to generate the XML source column, including populating the column from DB2 directly, or using a Column Export stage, or using a Transformer stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
srikan3
Participant
Posts: 4
Joined: Tue May 17, 2016 7:44 am
Location: Hyderbad

But we are not defining metadata in my case

Post by srikan3 »

Thanks Ray for your response,

We are using RCP as we need to pass the columns names dynamically, is there anyway to pass "XML source column" dynamically ?
Sri
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

This is a guess...but is there any way, via Modify or Column Export (or some other Stage) to force all the columns [with RCP] into one single column with a delimeter? ....such that you could declare a single column on the output link of a (say) a Column Export or Modify, and then have that be the single declared column going into the xml Transformer? ...and then have a single declared column out of the xmlTransformer? It could/would still be entirely generic, because it would be driven by your columns coming in that get dynamically concatenated. I haven't exercised those two stages or others with RCP to determine if you can do a dynamic "many cols" to "one declared col" easily.

That still may not solve things, as you would have to experiment heavily with the XML Transformer and xslt to see if you could convert a single comma delimited string into the xml you desire, on a row by row basis...but maybe..........?

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why can't you use a Column Export stage? It's inputs are defined by RCP, you can name a single column for its output without violating your overall requirement for RCP as this column will function dynamically.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
srikan3
Participant
Posts: 4
Joined: Tue May 17, 2016 7:44 am
Location: Hyderbad

Its working for fine single table extraction

Post by srikan3 »

I am using XML transformer stage to generate XML file from the source DB2 database, here for single file one job is working fine, but not able to convert the same job for multiple jobs.
Sri
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Rays point is for you to explicitly create a column, call it "myXMLinput" out of a Column Export (ie...zero columns in, using RCP, one fixed column out). That single column will have all the data. Then pass that into your xmlTransformer, with one column out (myXMLoutput).

It will require a lot of experimentation and probably some creative xslt, to convert delimited data into xml.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply