Trimming new line character

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

Post Reply
MOHAMMAD.ISSAQ
Participant
Posts: 78
Joined: Fri Mar 02, 2007 4:54 am
Location: CHENNAI

Trimming new line character

Post by MOHAMMAD.ISSAQ »

My project has JPN-SJIS character set.I'm reading a .csv file.When i view the data for the last columns have one unusual character at the end.
When i pasted it in text editor i found it as new line.

I want to trim this "new line" character, and my columns has variable length.

How can i do this?
Please help me out..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Assuming 'new line' = LF:

Code: Select all

Convert(CHAR(10),"",YourField)
Or

Code: Select all

EReplace(YourField,CHAR(10),"")
-craig

"You can never have too many knives" -- Logan Nine Fingers
MOHAMMAD.ISSAQ
Participant
Posts: 78
Joined: Fri Mar 02, 2007 4:54 am
Location: CHENNAI

Post by MOHAMMAD.ISSAQ »

Thanks Chulett for the help.
But still i'm not clear. Can you be more specific..
What's that LF,code and char(10) ?

I think i didn't given the clear picture.It's given below

My columns last character has newline('\n') but it appeared as some unusual character, since i've JPN-SJIS character set.And moreover my columns are not fixed width.

I think this will be more clear..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not sure how much more clear I can be. LF = 'Line Feed' = hex a = decimal 10 = 'new line'. If that's what your character is, then what was posted should work. If it isn't, then you'll need to post something more specific than it being 'some unusual character'.

Read the online help for the CHAR() function if you don't know what it does.
-craig

"You can never have too many knives" -- Logan Nine Fingers
MOHAMMAD.ISSAQ
Participant
Posts: 78
Joined: Fri Mar 02, 2007 4:54 am
Location: CHENNAI

Post by MOHAMMAD.ISSAQ »

Thanks a lot..
I've used that code but still same character is coming.
Since the 'new line' character is coming at the end.
I trimmed like this "Col_Name[1,Len(Col_Name)-1]"

It's working now..

Anyhow thanks again for the help..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Well, then it's not a new line. If you get the actual decimal value, then you can do as I suggested. However, if it is always just the last character in the field, then your substring is perfectly valid as well.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply