begins with function

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
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

begins with function

Post by parvathi »

Hi all,
Are there any datastage functions like begins with or ends with ...
I just want to check in the transformer that whether a certain coulmn begins with a particular word...
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Hi

do you mean Datastage reserved words. Please be more clear.
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Re: begins with function

Post by balajisr »

parvathi wrote:Hi all,
Are there any datastage functions like begins with or ends with ...
I just want to check in the transformer that whether a certain coulmn begins with a particular word...
There is a function named "Matches". Check that out.
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

Post by parvathi »

yes datastage reserved words ..
The scenario is as follows ..
i have to compare an input column in the transformer and check whether that column starts with the "begin" or "end" and then i have to do some more operations....
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Hi Parvathi

Use Constraint in transformer and inside that type the condition (eg InputColumn = 'begin' Or InputColumn = 'end'). This will only allow records with your conditions.

You can also have the same logic applied in your transformer expression using If clause.

If InputColumn = 'begin' Or InputColumn = 'end' Then Expression1 Else Expression2
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

Post by parvathi »

thanks ... i was to do with that idea
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

rasi wrote:If InputColumn = 'begin' Or InputColumn = 'end' Then Expression1 Else Expression2
Um... that doesn't check that the field starts with those values, that checks if they are equal to those values.

Substring would be one way:

Code: Select all

If InputColumn[1,5] = 'begin' Or InputColumn[1,3] = 'end' Then Expression1 Else Expression2
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There are Left() and Right() functions available. Using these would make the meaning in your expression pellucid.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Sorry Craig

I missed the substring....
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ray.wurlod wrote:Using these would make the meaning in your expression pellucid.
As noted, substring was just one way... these are another. To be transparently clear. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

Post by parvathi »

thanks a lot to everyone and to their valuable ideas.... I tried with all the options...
Post Reply