Trimmimg and concatination

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
SBSA_DW
Premium Member
Premium Member
Posts: 6
Joined: Thu Jul 24, 2008 1:53 am

Trimmimg and concatination

Post by SBSA_DW »

Hi

I'm using a triming function to trim a lot of unwanted characters in my data and after triming all these characters I also need to concatenate the column data with a number 20, but the concatenation does not happen. Is there a better way of achieving the result?

Trim(Trim(Trim(Trim(Trim(Trim(Trim(Trim(Trim(Trim(Trim(Trim
(Column_Name),'','L'),'#','L'),'+','L'),'.','L'),'//','L'),'/','L'),'\','L'),'`','L'),'','L'),'','T'),'*','L'):20
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try putting the right hand operand for the concatenation operator in quotes.

Code: Select all

Trim(Trim(Trim(Trim(Trim(Trim(Trim(Trim(Trim(Trim(Trim(Trim 
(Column_Name),'','L'),'#','L'),'+','L'),'.','L'),'//','L'),'/','L'),'\','L'),'`','L'),'','L'),'','T'),'*','L'):'20' 
Use a single Convert() function to get rid of the unwanted characters.

Code: Select all

Convert('#+./\`.*', '', InLink.ColumnName) : "20"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

But Convert will remove ALL such values - even though they are in the middle.

The OP wants the leading ones.
SBSA_DW
Premium Member
Premium Member
Posts: 6
Joined: Thu Jul 24, 2008 1:53 am

Post by SBSA_DW »

Yes I only want to remove the leading characters.

I have tried putting in quotes for the 20 and it still does not help.

Your response in appreciated
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If your derivation ends with

Code: Select all

:"20"
then the 20 will be added to the end of the string.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Maybe your output consumes more space than allocated ?

Ensure that the target field length = sumOf(length of all fields used in compulation) + 2
SBSA_DW
Premium Member
Premium Member
Posts: 6
Joined: Thu Jul 24, 2008 1:53 am

Post by SBSA_DW »

Thanks for your responses

The length is 250 and the max data in the column is 25 characters.

With the assistance of a colleague, I have done the triming in functions in a stage variable, then the concatenation in the column derivation and this has resolved my problem :D
Post Reply