loading CSV file data to table or text file

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rajadommeti
Premium Member
Premium Member
Posts: 43
Joined: Wed Feb 27, 2008 1:08 am

loading CSV file data to table or text file

Post by rajadommeti »

I am trying to read a CSV file and then load that data into a table or a file. I am not getting any idea on how i can achieve this. It is somewhat complex for me. Can you give me some idea on how i can do it ? I just showed 9 lines here but my spreadsheet has thousands of lines so i am trying to find a best way.

My input file :

Code: Select all

Name	A	B	C	D
BIAM	X	.	.	.
CALD	.	.	.	X
COCO	X	.	.	.
CRE2	.	.	X	.
CUST	X	.	.	.
HARP	X	.	.	.
DUF2	.	.	X	.
EPS1	X	.	.	.
EVA3	.	X	.	.


My output should be like this.

Code: Select all

Name	Role
BIAM	A
CALD	D
COCO	A
CRE2	C
CUST	A
HARP	A
DUF2	C
EPS1	A
EVA3	B
Can you please give some ideas??
RAJ
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Make sure to setup your sequential file stage for CSV input. Then define the five columns all as VarChar.

In your transformer you can define the second field in your output as something like:

If Inputlink.A = "X" then "A" Else if "Inputlink.B = "X" then "B", etc..

You might also have to check for lowercase "x" if the data was generated by hand.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
rajadommeti
Premium Member
Premium Member
Posts: 43
Joined: Wed Feb 27, 2008 1:08 am

Post by rajadommeti »

Thanks you Andy.
RAJ
Post Reply