Reading and writing data into csv files?

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
vgupta88
Participant
Posts: 32
Joined: Thu Aug 01, 2013 12:26 am
Location: Mumbai

Reading and writing data into csv files?

Post by vgupta88 »

Hi All,

I have a requirement where I need to read data from csv file (e.g. file_one.csv), apply some transformations on the data and then load that data into a new csv file (e.g. file_two.csv).
I tried using Unstructured Data stage as my Target but it shows me an error that "it doesn't support input links". Is it possible to achieve above requirement using Unstructured Data stage (version 9.1)?

Appreciate anyones help on the above query.

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

Post by chulett »

There's nothing "unstructured" about your data so why use that stage? Use the normal Sequential File stage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

csv files are simple text files that happen to have commas between data blobs that represent 'columns'. Nothing more.

You can process them just fine with a flat file & transformer stage.
vgupta88
Participant
Posts: 32
Joined: Thu Aug 01, 2013 12:26 am
Location: Mumbai

Post by vgupta88 »

Craig,

I have multiple tabs in the csv file which needs to be processed which I suppose makes it "Unstructured"

Thanks!
Vaibhav
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There are no tabs in a CSV file. It is a regular text file. Can you please be more specific?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vgupta88
Participant
Posts: 32
Joined: Thu Aug 01, 2013 12:26 am
Location: Mumbai

Post by vgupta88 »

My bad.. So to clear out confusion and to explain better - I have excel spreadsheets which are saved as .csv file format. ;-) These spreadsheets have multiple client specific tabs in it.
So now, I want to process these spreadsheets data, transform them and create a new excel spreadsheet with similar client specific details in separate tabs.
Vaibhav
anudeepdasari001
Participant
Posts: 58
Joined: Mon Dec 14, 2015 3:16 pm
Location: Arizona

Post by anudeepdasari001 »

Its not supported Writing to the spreadsheets using the unstructured Data Stage in 9.1 version, You can always do that in 11.5 version, Where you have ability to write to a single or all the sheets in a workbook.
anudpETL
vgupta88
Participant
Posts: 32
Joined: Thu Aug 01, 2013 12:26 am
Location: Mumbai

Post by vgupta88 »

So, any other method to achieve this?
The basic thing that I am looking after is generating new excel spreadsheet. I can manage with basic one single tab also.

Any help would be much appreciated!

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

Post by chulett »

Without access to the latest version, the typical answer for a "basic one single tab" would be simply another csv file. Excel will automatically open them as a spreadsheet, it would be up to the user to save it back as an xls.

You may be able to leverage ODBC for this, there are UNIX drivers specifically for Excel from what I recall. You would have to purchase them, however.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vgupta88
Participant
Posts: 32
Joined: Thu Aug 01, 2013 12:26 am
Location: Mumbai

Post by vgupta88 »

Thanks Craig!
Just one more concern, does metadata in different tabs present in excel sheet needs to same in Unstructured Data Stage?

Thanks in advance.
Vaibhav
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not that I am aware of, each is treated as a separate 'table' in essence from what I recall.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vgupta88
Participant
Posts: 32
Joined: Thu Aug 01, 2013 12:26 am
Location: Mumbai

Post by vgupta88 »

It seems like the metadata needs to be same. Otherwise it throws an error - Different number of columns in the sheets <sheet_name>.
Vaibhav
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That seems oddly... restrictive... to me. :?

Let's see what others have to say.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vgupta88
Participant
Posts: 32
Joined: Thu Aug 01, 2013 12:26 am
Location: Mumbai

Post by vgupta88 »

No inputs from anyone?

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

Post by chulett »

Open a support case.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply