.csv

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
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

.csv

Post by dspxlearn »

Hi,


While outputting the ds extract, if we give the output file name with the extension .csv , will datastage automatically convert into csv files.I searched across the forum but there was no post helpful to me.

And if it doesn't work what kind of setting to be done in the target sequential file.I mean, do we need to change in the format tab of the sequential file stage(record level, field defaults etc..)
Thanks and Regards!!
dspxlearn
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

DataStage won't care what extension you give a sequential file. It's up to you to make them meaningful if you so desire. In this case you would just need to ensure that the field/column delimiter defined in the output stage was set to a comma, which would be the default I would think.

Don't have access to PX right now, so can't get more specific than that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Aparna_A
Participant
Posts: 21
Joined: Wed Nov 09, 2005 11:16 pm

Post by Aparna_A »

Hi,

Just give the extension to the file as .csv, chk tht the Record Delimiter is Comma (thats by default), and final Delimiter is "end" (also by default).

This serves your purpose.
Aparna
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Hi chulett and Aparna,


Thanks for your earliest replies.We are using the delimiter as a parameter in which we are using ',' as a default value.So, i am not keeping the record delimiter as 'comma'.So, i think it should work...

You mean to say that even if we don't give the .csv extension it will result to a csv file when the 'record delimiter and final delimiters' is set to default values...!!
Thanks and Regards!!
dspxlearn
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

dspxlearn wrote:You mean to say that even if we don't give the .csv extension it will result to a csv file when the 'record delimiter and final delimiters' is set to default values...!!
Of course. There's no requirement that a 'comma separated value' file have a .csv extention, or even that a file with a .csv extension have commas as the separator. It may be expected but not required. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Hi Craig,

I got it!!
But i am facing data formatting issues..
I mean to say..suppose if my source value is
00109210s , i am getting 109210s, which is removing '00' from the front(which is the property of a csv file).
Similary it will do with the date data also,
for instance..
source target
05/11/2006 5/11/2006

but i should get as it is in the source(05/11/2006)... 8)

Is there any way to preserve the data formatting when outputting to a csv file... :?:
Thanks and Regards!!
dspxlearn
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

A Question: If the field is 50 byte STATE code,and the value takes just 15bytes. Would this csv formatting, eliminate the 'white' space.
ie. would the output be like #1 or #2
#1 1111 , "New York" , USA
#2 1111,New York,USA

Thanks, -V
dspxlearn wrote:Hi Craig,

I got it!!
But i am facing data formatting issues..
I mean to say..suppose if my source value is
00109210s , i am getting 109210s, which is removing '00' from the front(which is the property of a csv file).
Similary it will do with the date data also,
for instance..
source target
05/11/2006 5/11/2006

but i should get as it is in the source(05/11/2006)... 8)

Is there any way to preserve the data formatting when outputting to a csv file... :?:
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

vijay,

I am just wondering, if you gave me the answer or giving your problem!! :!:

Any suggestions :?:
Thanks and Regards!!
dspxlearn
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's called 'hi-jacking'. Please don't jump on the end of someone else's thread with a completely different problem. And don't do it to yourself, either. :P

You both need to start new threads on these two new subjects.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Hi Craig,

You are right 8)
But my problem is in continuation to the original post, posted by me...!!

Any Suggestions on the problem.. :?:
Thanks and Regards!!
dspxlearn
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

dspxlearn wrote:Hi Craig,

I got it!!
But i am facing data formatting issues..
I mean to say..suppose if my source value is
00109210s , i am getting 109210s, which is removing '00' from the front(which is the property of a csv file).
Similary it will do with the date data also,
for instance..
source target
05/11/2006 5/11/2006

but i should get as it is in the source(05/11/2006)... 8)

Is there any way to preserve the data formatting when outputting to a csv file... :?:
I think the key to remember is that there is not a default format of CSV in DataStage. You have to explicitly tell DataStage how you want your output data formatted. If you want numbers to be zero padded, then you have to specify that in your export schema. Same with date formats. Those formats may be standard for a true CSV file (exported from MS Excel or Access), but like I said - DataStage does not have a standard way to export a CSV file with those formatting rules unless you create your schema that way.

Now, perhaps the powers-that-be should have some 'standardized' import/export formats. Rather than specifying all these rules about field delimter of ',', record delimiter end, datatype formatting, etc. all you have to do is specify that the file is standard CSV format and DataStage takes care of the rest.

I have a similar beef with exporting data to a file that will be loaded into DB2. DataStage can export the data a lot faster than DB2, but there are some specific rules that DB2 uses when exporting data that are a pain to recreate in DataStage. The rules make it easy for DB2 to load the file, and are default actions when DB2 exports. And considering how well DataStage works with DB2, why can't they create some standard formatting tools for exporting data? I'd like to see a DB2-specific export stage that produces files EXACTLY the same format that DB2 would create.

Okay, I'll get off my soap box now. Anyway, hope my explanation of the CSV issue makes sense.

Brad.
Post Reply