String Handling

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

veera24
Premium Member
Premium Member
Posts: 150
Joined: Thu Feb 07, 2008 9:37 pm
Location: NewYork

String Handling

Post by veera24 »

Hi all.
Some of the coulmns in a file needs to be in double quotes (say string data type columns) and the rest are not to be in the quotes. So is there any way of doin this?

I know one solution that we can suprees the quote character and then concatenate the quotes in the transformer coulmn level derivation wherever we want (i mean in the column level derivation of transformer). Is this only way of doing it or any thing else there?

If so kindly help me.

Your time would be highly appreciated.

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

Post by ray.wurlod »

You can set the quote character in the Format properties of a Sequential File stage. (Technically it's in the link properties.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
battaliou
Participant
Posts: 155
Joined: Mon Feb 24, 2003 7:28 am
Location: London
Contact:

Post by battaliou »

An example of your output data here would be useful.

If you simply require varchar to be quoted and numerics to be not in a sequential comma seperated file then set the quotes setting to "

Alternatively you could simply have 1 output string a varchar 9999 for example in which you construct your entire string.
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
battaliou
Participant
Posts: 155
Joined: Mon Feb 24, 2003 7:28 am
Location: London
Contact:

Post by battaliou »

An example of your output data here would be useful.

If you simply require varchar to be quoted and numerics to be not in a sequential comma seperated file then set the quotes setting to "

Alternatively you could simply have 1 output string a varchar 9999 for example in which you construct your entire string.
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What you require should be handled automatically by the stage as long as the data types are defined correctly for each field.
-craig

"You can never have too many knives" -- Logan Nine Fingers
veera24
Premium Member
Premium Member
Posts: 150
Joined: Thu Feb 07, 2008 9:37 pm
Location: NewYork

Post by veera24 »

ray.wurlod wrote:You can set the quote character in the Format properties of a Sequential File stage. (Technically it's in the link properties.) ...
If that is the case, wont other columns will be having quotes?

As i said earlier i wanna have the quotes for particular columns as i need not all the columns. So pls. suggest. Or kindly let me know that the solution i've
mentioned in my question will be right or any other way of doing that?


Thanks for your time ray

Your time will be highly appreciated.

Thanks in advance
Veera
veera24
Premium Member
Premium Member
Posts: 150
Joined: Thu Feb 07, 2008 9:37 pm
Location: NewYork

Post by veera24 »

chulett wrote:What you require should be handled automatically by the stage as long as the data types are defined correctly for each field. ...
How come it will be correct?Could you pls. elaborate with an example so that i can easily understand because of you :)

Your time will be highly appreciated



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

Post by chulett »

When writing, 'string' columns are automatically quoted while 'numeric' fields are not. Why not simply try it and see if it works the way you need?
-craig

"You can never have too many knives" -- Logan Nine Fingers
veera24
Premium Member
Premium Member
Posts: 150
Joined: Thu Feb 07, 2008 9:37 pm
Location: NewYork

Post by veera24 »

chulett wrote:When writing, 'string' columns are automatically quoted while 'numeric' fields are not. Why not simply try it and see if it works the way you need? ...
Hi Chulett,
Thanks a lot for your advice. I've tried it and i got the output as you've mentioned earlier and also as i wanted. Thanks again for your time.

Thanks in advance,
Veera
veera24
Premium Member
Premium Member
Posts: 150
Joined: Thu Feb 07, 2008 9:37 pm
Location: NewYork

Post by veera24 »

chulett wrote:When writing, 'string' columns are automatically quoted while 'numeric' fields are not. Why not simply try it and see if it works the way you need? ...
Hi chulett,
I dont want the quotes for string and as well as timestamp column. how do i can achieve this?because by default the column will have double quotes as it is non-numeric field.Am i right?

Kindly suggest me.

Thanks in advance,
veera.
veera24
Premium Member
Premium Member
Posts: 150
Joined: Thu Feb 07, 2008 9:37 pm
Location: NewYork

Post by veera24 »

chulett wrote:When writing, 'string' columns are automatically quoted while 'numeric' fields are not. Why not simply try it and see if it works the way you need? ...
Hi chulett,
I dont want the quotes for string and as well as timestamp column. how do i can achieve this?because by default the column will have double quotes as it is non-numeric field.Am i right?

Kindly suggest me.

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

Post by chulett »

veera24 wrote:I dont want the quotes for string and as well as timestamp column.
I have no idea what you want or don't want here. :?

What is being quoted right now that you don't want quoted and why do they bother you? All fields can be quoted without issue or causing anyone any problems, hence the question.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

Veera, In the format tab, enter 000 for quote character box !! Nothing will be quoted :)
Kandy
_________________
Try and Try again…You will succeed atlast!!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Obviously, they want or need something quoted or this conversation would have been over quite some time ago. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use 000 for the quote character on the Format, and use SQuote() function for each field that needs to be quoted. This allows individual fields to be quoted without all string fields to be quoted.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply