Page 1 of 1

RE.XML output stage

Posted: Sun Dec 10, 2006 10:55 pm
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.

Posted: Sun Dec 10, 2006 11:14 pm
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.

Re: RE.XML output stage

Posted: Sun Dec 10, 2006 11:20 pm
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.

Posted: Tue Dec 12, 2006 6:22 pm
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

Posted: Tue Dec 12, 2006 7:19 pm
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'.

Re: RE.XML output stage

Posted: Wed Dec 13, 2006 1:52 pm
by samythiru
Thanka a lot

Posted: Wed Dec 13, 2006 1:53 pm
by samythiru
Thanks a lot