DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
This topic has been marked "Resolved."
Author Message
bikan



Group memberships:
Premium Members

Joined: 08 Jun 2006
Posts: 128

Points: 1241

Post Posted: Mon Jun 22, 2009 6:15 am Reply with quote    Back to top    

DataStage® Release: 7x
Job Type: Parallel
OS: Unix
Additional info: Xpath Expression..
Hi All,

I have a source file like
Metadata--custno,add1,add2,city,add1,add2,city,amount
Data file---11111,abcd,defg,xyz,lkmn,abcd,pune,1000.

I want output as
<Cust>
<Customerno> 11111 </Customerno>
<add1>abcd</add1>
<add2>defg</add2>
<city>xyz</city>
<add1>lkmn</add1>
<add2>abcd</add2>
<city>pune</city>
<amount>1000</amount>
</Cust>

I have tried with every options(i.e by taking each and every column as primary key and using trigger column) but i am not getting output in required format.

I am taking Xpath Expression as
/Cust/customerID/text()
/Cust/customerID/add1/text()
/Cust/customerID/add2/text()
/Cust/amount/text()
/Cust/customerID/add1/text()

but i am not getting write output.

I have gone through XML best practice document too.

Please help.

Thanks
Murari
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 43085
Location: Denver, CO
Points: 222463

Post Posted: Mon Jun 22, 2009 6:40 am Reply with quote    Back to top    

What are you getting?

_________________
-craig

"You can never have too many knives" -- Logan Nine Fingers
Rate this response:  
Not yet rated
bikan



Group memberships:
Premium Members

Joined: 08 Jun 2006
Posts: 128

Points: 1241

Post Posted: Mon Jun 22, 2009 6:56 am Reply with quote    Back to top    

Hi,

I am getting output as
<Cust>
<Customerno> 11111 </Customerno>
<add1>abcd</add1>
<add2>defg </add2>
<city>xyz, lkmn, abcd, pune</city>
<amount>1000</amount>
</Cust>

Means it is not taking second record as new line.

Thanks
Murari
Rate this response:  
Not yet rated
eostic

Premium Poster



Group memberships:
Premium Members

Joined: 17 Oct 2005
Posts: 3833

Points: 30939

Post Posted: Mon Jun 22, 2009 8:10 pm Reply with quote    Back to top    

You may need to group those together, as they probably should be in their xsd..... for the sake of testing, try wrapping those three elements in a larger element, such as "detail":

.../detail/add1/text()
.../detail/add2/text()
.../detail/city/text()

Make one of them the repeating element and use Aggregate as your option.

...if that works, it tells us a bit more about your structure and rows, and then also we can look at possible ways to remove it afterwards.

Ernie

_________________
Ernie Ostic

blogit!
Open IGC is Here!
Rate this response:  
Not yet rated
bikan



Group memberships:
Premium Members

Joined: 08 Jun 2006
Posts: 128

Points: 1241

Post Posted: Mon Jun 22, 2009 11:04 pm Reply with quote    Back to top    

Hi All,

I am getting same ouput only after including one more parent
i.e
/Cust/add/add1/text()

then also i am not getting right answer.

Please help me.

I am getting output as
<Cust>
<Customerno> 11111 </Customerno>
<add>
<add1>abcd</add1>
<add2>defg </add2>
<city>xyz, lkmn, abcd, pune</city>
</add>
</Cust>
Rate this response:  
Not yet rated
bikan



Group memberships:
Premium Members

Joined: 08 Jun 2006
Posts: 128

Points: 1241

Post Posted: Wed Jun 24, 2009 5:26 am Reply with quote    Back to top    

Hi All,

Please reply to this question.

Thanks in Advance
Rate this response:  
Not yet rated
eostic

Premium Poster



Group memberships:
Premium Members

Joined: 17 Oct 2005
Posts: 3833

Points: 30939

Post Posted: Wed Jun 24, 2009 6:45 am Reply with quote    Back to top    

I think I see the issue. Sorry I didn't notice it before. In order to get DataStage XMLOutput to treat these as separate elements (whether in a greater parent or not, which you still may need to do), you need to get them truly into two rows. I failed to notice first time around that the columns are all in one row. Pivot the data first so that you have two lines of address information, each line (row) having the common customer key value. Then "aggregation" makese sense, and it can group the two addresses into a larger "addresses" element "under" the customer.

There are lots of entries in the forum here on pivot, but before you try that, set up a test file that just has two rows in it, each with a single add1, add2, city set of columns.

Ernie

_________________
Ernie Ostic

blogit!
Open IGC is Here!
Rate this response:  
Not yet rated
VijayDS
Participant



Joined: 18 Jun 2009
Posts: 38

Points: 350

Post Posted: Fri Jun 26, 2009 3:16 am Reply with quote    Back to top    

Hi bikan,

Same type of requirement I handled like mentioned below with server job by using XML Writer stage in Datastage 7.5. Before this we tried with the Parallel job and the output also generated but the format of the output file is not proper. I mean the open tag and closed tag's are not generated in single line if we open the file in internat explorer. Because of this reason we handled this with server job by using XML Writer stage.

My output is:
<List>
<AsOf>value</AsOf>
<fund>
<fundID>value</fundID>
<share>
<class>value</class>
<Code>value</Code>
<Name>value</Name>
<IDate>Date</IDate>
<Symbol>value</Symbol>
<nav>
<List>

Logic:
/List/AsOf
/List/fund/fundID
/List/fund/share/class
/List/fund/share/Code
/List/fund/share/Name
/List/fund/share/IDate
/List/fund/share/Symbol
/List/fund/share/nav










bikan wrote:
Hi All,

I have a source file like
Metadata--custno,add1,add2,city,add1,add2,city,amount
Data file---11111,abcd,defg,xyz,lkmn,abcd,pune,1000.

I want output as
<Cust>
<Customerno> 11111 </Customerno>
<add1>abcd</add1>
<add2>defg</add2>
<city>xyz</city>
<add1>lkmn</add1>
<add2>abcd</add2>
<city>pune</city>
<amount>1000</amount>
</Cust>

I have tried with every options(i.e by taking each and every column as primary key and using trigger column) but i am not getting output in required format.

I am taking Xpath Expression as
/Cust/customerID/text()
/Cust/customerID/add1/text()
/Cust/customerID/add2/text()
/Cust/amount/text()
/Cust/customerID/add1/text()

but i am not getting write output.

I have gone through XML best practice document too.

Please help.

Thanks
Murari

_________________
Thanks
Vijay
Rate this response:  
Not yet rated
Sreenivasulu



Group memberships:
Premium Members

Joined: 16 Oct 2003
Posts: 892

Points: 4326

Post Posted: Fri Jun 26, 2009 3:59 am Reply with quote    Back to top    

I have observerd that file formatting functions are better enabled in server jobs than in parallel jobs

Regards
Sreeni
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours