RE.XML output stage

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
samythiru
Participant
Posts: 13
Joined: Tue Feb 28, 2006 3:55 pm

RE.XML output stage

Post by samythiru »

Hi ,

I want to use CSV as input and I have to insert data into DB2. But I have to use some of the fields in CSV to generate the XML . Then XML has to go into DB2 in one field .Some of the fields from CSV has to go to the database as direct inserts. I am able to generate XML . But I am not able to combine the XML output with the fields in CSV before inserting into the Database.

If anyone know How to combine the XML output with the CSV output or How to solve this issue -before inserting into the DATABASE please let me know.
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Post by thebird »

You have not mentioned your problem. How are you trying to combine your records? Are you getting errors - if so what are they? Provide more details so that someone can help you better.
Last edited by thebird on Sun Dec 10, 2006 11:23 pm, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: RE.XML output stage

Post by chulett »

samythiru wrote:But I am not able to combine the XML output with the fields in CSV before inserting into the Database.
Two steps. One to 'create the XML' and stage it in a hashed file (typically as a chunk) keyed in such a manner as to match your incoming csv's key fields. Then stream the csv files in again, pick up the XML from the hashed file lookup and then insert the combined data into DB2.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Hi samythiru....

It's a little known fact that the XML Stages support a concept of "pass thru". This means that you can bring in, say, 100 colums to an XMLOutput Stage, put 20 of them into an XML string, and then pass out 81 columns...... 1 chunk of XML nicely formatted from your 20 columns into a new column called (for instance) myXML, and the other 80 columns "as is". Just be sure that you mention the other 80 columns in exactly the same way (same spelling, etc.) on the input and output links, and that you only have valid XPath syntax in the Description for the columns whose values you are truly interested in embedding within XML tags.

Use a single slash "/" in the Description for myXML on the output link, and be advised to select "XML Chunk" in the properties and uncheck "formatted output".

Ernie
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hey, I knew that! I'm just so used to breaking things up into logical chunks that I espoused that approach here. But now that I think about it, I like your answer more better. :wink:

I'll have to keep that in mind for 'next time'.
-craig

"You can never have too many knives" -- Logan Nine Fingers
samythiru
Participant
Posts: 13
Joined: Tue Feb 28, 2006 3:55 pm

Re: RE.XML output stage

Post by samythiru »

Thanka a lot
samythiru
Participant
Posts: 13
Joined: Tue Feb 28, 2006 3:55 pm

Post by samythiru »

Thanks a lot
Post Reply