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.
RE.XML output stage
Moderators: chulett, rschirm, roy
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.
Re: RE.XML output stage
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.samythiru wrote:But I am not able to combine the XML output with the fields in CSV before inserting into the Database.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
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
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
Re: RE.XML output stage
Thanka a lot