Page 1 of 1

Matching columns - Using TRIM

Posted: Mon Jul 11, 2005 11:19 am
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,

Posted: Mon Jul 11, 2005 2:13 pm
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

Posted: Tue Jul 12, 2005 3:59 pm
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