Using trim

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
rchintala
Participant
Posts: 2
Joined: Sat Dec 20, 2008 5:55 am

Using trim

Post by rchintala »

I have seen some one suing trim function in the following manner

trim [Expresion, " ", B] but trim function says character specifies a character other than a space or a tab. so please suggest if above usage of trim function trim [Expresion, " ", B] works.

It is all about using trim function is trimming leading and trailing spaces so i suggest that i want to trim[expression]

Please advise which is better option . Also i understand trim is basic function is it advisable to use in parrellel job? if and what should we use
Ranga chintala
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

Trim is used everywhere.. server or px !!
Kandy
_________________
Try and Try again…You will succeed atlast!!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Square brackets indicate optional parts of the syntax. Trim() is a function, so the argument list is surrounded by parentheses, not square brackets.

The third argument to Trim() must be a literal string (that is, quoted) or the name of a variable. In your case

Code: Select all

Trim(Expression, " ", "B")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rchintala
Participant
Posts: 2
Joined: Sat Dec 20, 2008 5:55 am

Thanks ray but my question i little different

Post by rchintala »

ray.wurlod wrote:Square brackets indicate optional parts of the syntax. Trim() is a function, so the argument list is surrounded by parentheses, not square brackets.

The third argument to Trim() must be a literal ...
Can we use trim trim (Expresion, " ", B). since trim function says character specifies a character other than a space or a tab. but here some one using to trim space.

also I want to check if Trim () is just sufficiant to trim leading and trailing spaces
Ranga chintala
laknar
Participant
Posts: 162
Joined: Thu Apr 26, 2007 5:59 am
Location: Chennai

Post by laknar »

try this
Trim(Expresion,'-','A')
Regards
LakNar
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Trim() with only one argument trims leading, trailing and redundant white space characters, exactly as described in the documentation.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vasa_dxx
Participant
Posts: 39
Joined: Sun Sep 28, 2008 2:59 am
Contact:

Post by vasa_dxx »

If you want to Extract n char from a string, go for Left or Right Functions.
Left(string,Number).
Two wrongs don't make a right. But three lefts do.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Curious what this has to do with the topic at hand... or are you just delivering random nuggets as early Christmas presents?
-craig

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