Page 1 of 1

.csv

Posted: Thu May 11, 2006 6:26 am
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..)

Posted: Thu May 11, 2006 6:42 am
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.

Posted: Thu May 11, 2006 6:57 am
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.

Posted: Thu May 11, 2006 7:51 am
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...!!

Posted: Thu May 11, 2006 8:21 am
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:

Posted: Thu May 11, 2006 8:52 am
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... :?:

Posted: Thu May 11, 2006 9:05 am
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... :?:

Posted: Thu May 11, 2006 9:13 am
by dspxlearn
vijay,

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

Any suggestions :?:

Posted: Thu May 11, 2006 9:36 am
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.

Posted: Thu May 11, 2006 9:45 am
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.. :?:

Posted: Thu May 11, 2006 3:26 pm
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.