Page 1 of 1

DB2 equivalent of substr()

Posted: Wed Jul 19, 2006 8:25 am
by opdas
Hi,
We have source as flat file and have to load another flat file and have to transform a field which would be picking a substring.

Its like picking a substring in a DB2 table using function substr(column,3,5) , which would give be a substring from character 3 to character 5 of the string.

Do we have a datastage equivalent for this ??

Posted: Wed Jul 19, 2006 8:28 am
by DSguru2B
I know in server you do
Incolumn[3,5]. Not sure if that works in a PX transformer. Someone else here needs to confirm that.

Posted: Wed Jul 19, 2006 8:32 am
by Krazykoolrohit
In parallel do Columnname[3,5]

should work

Posted: Wed Jul 19, 2006 2:28 pm
by us1aslam1us
Krazykoolrohit wrote:In parallel do Columnname[3,5]

should work
The OP needs substring from character 3 to character 5.

Code: Select all

Columnname[3,2] 
Thanks
Sam

Posted: Wed Jul 19, 2006 2:48 pm
by Krazykoolrohit
Oh. i read other syntaxes and thought he needs 5 characters from 3rd position. my mistake.. :oops:

Re: DB2 equivalent of substr()

Posted: Wed Jul 19, 2006 2:56 pm
by DSguru2B
opdas wrote:Its like picking a substring in a DB2 table using function substr(column,3,5) , which would give be a substring from character 3 to character 5 of the string.
Actually the OP contradicts his statement. We all just looked at his substr() example

Posted: Wed Jul 19, 2006 5:42 pm
by ray.wurlod
In a Modify stage numbers are zero-based, so the third character is number 2 and the required function is either substring[2,5](field) or substring[2,3](field) as the other issue is resolved.

Posted: Wed Jul 19, 2006 9:13 pm
by opdas
Thank you everybody ......

Posted: Thu Jul 20, 2006 8:15 pm
by dsdesigner
In a parallel transformer right(left(column_name,5),2)??

Shekar

Posted: Thu Jul 20, 2006 8:50 pm
by ray.wurlod
Cumbersome. Parallel Transformer supports the [,] syntax. Choose Substring from the operator menu in the Expression Editor.