Put quotes around fields in sequential file only with commas

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
jweir
Participant
Posts: 134
Joined: Wed Aug 04, 2010 12:31 pm

Put quotes around fields in sequential file only with commas

Post by jweir »

Hi All,

I am having trouble putting double quotes around a field when writing to a sequential file when the field contains a comma. The file itself is a CSV. So if the field does not contain a comma within it, it shouldn't be enclosed within double quotes, but when the field does contain a comma, it should be.

Thanks in advance.
Jweir

--- If strength were all, tiger would not fear scorpion.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... this is a DataStage question? As in you're having this issue with the Sequential File stage in a parallel job? Just wanted to double-check since the question was pretty generic. In any case, I am wondering why you are worried about the quotes, specifically the need to only have them when there's a comma in the data. Would having them there all the time cause a problem? It doesn't really seem like something to me that you should be worried about.

The only other clarification would be the "contains a comma" statement. Not could contain but actually does contain, as in a record by record check of the actual data? One record might have quotes around field X while the next record may not, in other words. Perhaps over-thinking things a bit this morning but looking to define the scope of the issue if we move forward with it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mouthou
Participant
Posts: 208
Joined: Sun Jul 04, 2004 11:57 pm

Post by mouthou »

Question/scenario makes the brain to wander a little bit! In future, putting some sample input and expected output will help.

Is this your clarification on when the quotes will be put by DataStage. Are you creating the file by using SeqFile stage in which you will get quotes for all fields and not face the particular issue which you explained?
Post Reply