DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
Author Message
karumudi7
Participant



Joined: 11 Mar 2012
Posts: 20
Location: Detroit
Points: 304

Post Posted: Thu May 30, 2019 12:03 am Reply with quote    Back to top    

DataStage® Release: 11x
Job Type: Parallel
OS: Unix
Hello,

I am receiving a file(s) like below, with header as Keys.
So I need to transpose the data to (Key, Value) pairs dynamically. I am able to convert using the Pivot Enterprise stage with Horizontal Pivot, but how to capture the Header and generate the column as shown in desired output?

Code:
File1:
UID|Age|Income|Golf|Outdoor
nabvj42|30|80000|Y|Y
ahfva87987|27|20000|N|N

File2:
UID|MarStatus|Car|Geek|Income
hf7gsb|N|Y|Y|20000
hgj780|Y|Y|N|90000


Desired Output:

Code:
File1:
nabvj42|Age|30
nabvj42|Income|80000
nabvj42|Golf|Y

File2:
hf7gsb|MarStatus|N
hf7gsb|Car|Y
hf7gsb|Geek|Y
hf7gsb|Income|20000


Because my target table has only 3 columns to store the incoming data dynamically.
Code:
UID|Key|Value

_________________
DataStage 11.3 on AIX 7.1 with DB2.
ray.wurlod

Premium Poster
Participant

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

Joined: 23 Oct 2002
Posts: 54534
Location: Sydney, Australia
Points: 295710

Post Posted: Thu Jun 13, 2019 1:50 am Reply with quote    Back to top    

What have you tried? This is probably more easily accomplished using looping in a Transformer stage, building the output line as you traverse the loop and generating an output row only when LastR ...

_________________
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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