RTRIM(LTRIM()) help

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
him121
Premium Member
Premium Member
Posts: 55
Joined: Sat Aug 07, 2004 1:50 am

RTRIM(LTRIM()) help

Post by him121 »

hi..
guys..
we have more than 100 columns in Source DRS Stage...
in derivation we want to write RTRIM(LTRIM()) for all the CHAR Columns..
this is taking lot of time to write manually..

is there any shortcut method to this.

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

Post by chulett »

Not really. Your RTRIM/LTRIM syntax is database syntax, you could replace it with just Trim() in the derivation and accomplish the same thing.

If you are good with something like Perl or Awk (or perhaps a good editor), you may be able to export your job to .dsx or .xml format and make the substitutions that way. Then just import it back into the project and recompile.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

The 7.1 Designer has a macro (right click on a column) to propagate a common function, like TRIM, to all derivations in a link. Can save a lot of time, check it out.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's true - forgot about that one. :oops: Open up your transformer and right-click in the derivation. You'll find something called Derivation Substitution that should get you what you need.

Available in 7.0 and up.
-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:

Performance

Post by ray.wurlod »

The correct function names are TRIMB and TRIMF rather than RTRIM and LTRIM.

But you can also use the extended form of TRIM, where the third argument of "B" removes leading and trailing. For example, TRIM(TheString, " ", "B") removes leading and trailing spaces.

One function is cheaper to execute than two. When you're processing milions of rows, every little gain helps.
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