How to read whole XML file as a string and in DataStage.

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
vgundavarapu
Premium Member
Premium Member
Posts: 22
Joined: Wed May 08, 2013 8:38 am
Contact:

How to read whole XML file as a string and in DataStage.

Post by vgundavarapu »

Hi All,

I have XML file, so I need to read whole XML file as a string and map to one output column in DataStage. I have tried no. ways, but no luck. Please help on this.


Thanks,
Venkata
Thanks,
Venkata Gundavarapu
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Have you tried using the XML stage?

Here is an article link.

http://www.ibm.com/developerworks/data/ ... index.html
Choose a job you love, and you will never have to work a day in your life. - Confucius
vgundavarapu
Premium Member
Premium Member
Posts: 22
Joined: Wed May 08, 2013 8:38 am
Contact:

How to read whole XML file as a string and in DataStage.

Post by vgundavarapu »

Thank you for your quick reply.

I am using XML stage currently.

I have read that online document, but they didn't mentioned exactly how to read whole XML file and map to one column.

They only talked about retrieving two flat files and composed as XML file and load into DB2 table.

In my case, I have XML file as source and need to load whole XML file into DB2 Column as XML type or STRING.


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

Post by chulett »

There's no need for two conversations on the same topic. This one wins.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vgundavarapu
Premium Member
Premium Member
Posts: 22
Joined: Wed May 08, 2013 8:38 am
Contact:

How to read whole XML file as a string and in DataStage.

Post by vgundavarapu »

Hi Craig,

It's OK for me.

I have read online documents since morning as you mentioned, but I didn't find the correct solution so far.

I need to one thing is how to read whole XML file as String.


Thanks,
Venkata
Thanks,
Venkata Gundavarapu
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

If you are just reading it all as one big string, and it's in a disk file, then use a Server Job, with a Folder Stage...that will pick up "the whole file" within a single column......push it wherever you want to. No sense parsing the xml if you don't have to.

When you drop the Folder Stage and create an output link, load the built-in table definition onto it (it's in the Table Defs/Built-in category). Your contents will go into the column called "Record".

The Connectors were updated awhile back for xml types of columns, but do some careful testing independently before you include the xml.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Just to clarify, do you want to dump it into a DB2 column with a data type of CLOB or XML, and not parse the XML or validate it?
Choose a job you love, and you will never have to work a day in your life. - Confucius
yugee
Participant
Posts: 34
Joined: Fri Feb 04, 2011 5:54 pm

Post by yugee »

Try declaring your input column as SQLtype - LongVarChar, Extented - Unicode and don't mention the length
Post Reply