Converting CR and LF to Empty stirng

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
mac4rfree85
Participant
Posts: 126
Joined: Thu Jul 01, 2010 11:39 pm

Converting CR and LF to Empty stirng

Post by mac4rfree85 »

Hi Guys,

I like to convert CR and LF which is coming in a particular column to Empty string.

I tried the following but it was not converted.

Code: Select all

Convert('chr(10)chr(13)','',COLNAME)
Can somebody help me with this.

Cheers!!!
Mac4rfree
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

Try using below derivation.

Covert(char(13),'',Convert(char(10),'',COLNAME))
Cheers
Ravi K
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Converting CR and LF to Empty stirng

Post by chulett »

mac4rfree85 wrote:I tried the following but it was not converted.
You quoted the char functions you were attempting to use so they just turned into a 14 character string.
-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 »

You also used incorrect function names, and did not concatenate them.

The correct equivalent for your expression is

Code: Select all

Convert(Char(10) : Char(13), "", InLink.COLNAME)
However there is a cost in evaluating the Char() function. More efficient would be to create a stage variable, let's call it svCRLF, initialized to Char(13) : Char(10), and not given a derivation for each row. Then the expression becomes

Code: Select all

Convert(svCRLF, "", InLink.COLNAME)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mac4rfree85
Participant
Posts: 126
Joined: Thu Jul 01, 2010 11:39 pm

Post by mac4rfree85 »

Yeah Ray, i found it later.. thanks anyway.. :)
Mac4rfree
Post Reply