Page 1 of 1

Extract substring

Posted: Tue Aug 07, 2012 9:42 pm
by DSRajesh
Hi All,

How to extract substring "settle" in the string XXX_Settle" using datastage functions?

Posted: Tue Aug 07, 2012 9:50 pm
by jwiles
Search here (Information Server 8.7 Information Center) for "extracting substrings". The functions are largely valid for DS 7x as well. You can also search the DS 7x documentation included with the product.

Posted: Tue Aug 07, 2012 11:41 pm
by ray.wurlod
Do you want the rightmost six characters every time? Do you want everything after the underscore character irrespective of how long? There are many possibilities. The link James provided will allow you to research them all, but a more specific question would allow us to help more cogently.

Posted: Wed Aug 08, 2012 2:59 am
by DSRajesh
Hi Ray,

I need to pick the all the character before '-' in the string.

Posted: Wed Aug 08, 2012 3:34 am
by Ravi.K
Apply Index function it will give position of the "-" then apply substring function.

Posted: Wed Aug 08, 2012 3:40 am
by ssreeni3
Hi,

Single "_" or might chance multiple"_" s occurs in the string?

_____________________________________________________
Sreeni

Posted: Wed Aug 08, 2012 3:44 am
by ssreeni3
Hi,

Use the below function to get all the characters before the first "_" in a column
Field(Column_Name,"_",1)
It might work.

______________________________________________________
Sreeni

Posted: Wed Aug 08, 2012 6:57 am
by chulett
DSRajesh wrote:I need to pick the all the character before '-' in the string.
Which doesn't match your example and the original question. Did you actually mean after the "_"?

Posted: Wed Aug 08, 2012 8:15 am
by DSRajesh
craig

It is before "_" .

Posted: Wed Aug 08, 2012 8:34 am
by Ravi.K
As Sreeni said,

Field(Column_Name,"_",1)

It will solve the issue...

Posted: Wed Aug 08, 2012 3:08 pm
by ray.wurlod
SO, not substrings but "delimited substrings".

An equivalent to the Field() function would be square brackets notation.

Code: Select all

Column_Name["_",1,1]