Extract substring

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
DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Extract substring

Post by DSRajesh »

Hi All,

How to extract substring "settle" in the string XXX_Settle" using datastage functions?
RD
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post 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.
- james wiles


All generalizations are false, including this one - Mark Twain.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Post by DSRajesh »

Hi Ray,

I need to pick the all the character before '-' in the string.
RD
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

Apply Index function it will give position of the "-" then apply substring function.
Cheers
Ravi K
ssreeni3
Participant
Posts: 29
Joined: Fri May 18, 2012 1:35 am

Post by ssreeni3 »

Hi,

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

_____________________________________________________
Sreeni
ssreeni3
Participant
Posts: 29
Joined: Fri May 18, 2012 1:35 am

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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 "_"?
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Post by DSRajesh »

craig

It is before "_" .
RD
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

As Sreeni said,

Field(Column_Name,"_",1)

It will solve the issue...
Cheers
Ravi K
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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]
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply