Matching columns - Using TRIM

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
Titto
Participant
Posts: 148
Joined: Tue Jun 21, 2005 7:49 am

Matching columns - Using TRIM

Post by Titto »

Hi All,


I have a input file which has CHAR(30) length column and i need to match this column with DB2 table CHAR(30) column to get the data, But the question is from the Input CHAR(30) i need to table only 28 char to match with table char values as the last 2 chars in input file has some value. So I am using Substring and Trim function to get 28 char from file and trying to match with Table CHAR(30) it is not able to match the record and rejecting all the records. Any thoughts!!!
Eg:-
From File CHAR(30) = 'ABCDEFG YZ'
From table CHAR(30) = 'ABCDEFG'
if i use Trim(Substrings("String", 1 ,28 ),' ', 'E')
Thanks in advance,
pnchowdary
Participant
Posts: 232
Joined: Sat May 07, 2005 2:49 pm
Location: USA

Post by pnchowdary »

Hi Titto,

Try using the below conversion

Code: Select all

Susbstrings((TrimB(String),1,28))
The problem with what you are doing is that you are first extracting the subtstring and then trimming the space. Whereas to get a match, you need to first trim the spaces and then extract your substring.

Hope this solves your problem.

Thanks,
Naveen
Rboudr2035
Participant
Posts: 2
Joined: Wed Jun 09, 2004 7:09 am

Post by Rboudr2035 »

Hi Titto

Try
Ans = Trim(input[1,Len(trim(input,' ','E'))-2],' ','E')

Not sure if the last 2 chars are in fix position (29&30) or if they could float.

Russell
Post Reply