Need 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
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Hi Prabhu

What exactly you want to do and what does the 3rd condition do?

Sam
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Re: Need SubString

Post by rwierdsm »

praburaj,

You need an output column in your transform stage that has a derivation something along these lines:

Code: Select all

If input.expense_level [1,3] <> 'LPG' then input.expense_level else
if input.expense_level [1,3] = 'LPG' then 'NPG' : input.parent_expense_level [4,30] else  
if input.expense_level [1,3] = 'LPG' and index(input.expense_level, '*', 1) = 0 then >reject processing of your choice<
I wasn't completely clear on what you want in your second condition, but it should be something similar to what you see above.

If the Parent_expense_level is coming from your hash file as a lookup value, ensure you are setting either a constraint or a default value if the lookup fails.

Hope this helps,

Rob
Rob Wierdsma
Toronto, Canada
bartonbishop.com
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why me particularly? :?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

Post by praburaj »

I expect all help. Plz help me. I want solve the problem.

Regards,

prabu
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Hi Prabhu

I think you can join condition 2 and 3 and use Robs code like this:

Code: Select all

If input.expense_level [1,3] <> 'LPG' then input.expense_level else 
if input.expense_level [1,3] = 'LPG' and index(input.expense_level, '*', 1) = 1 then 'NPG' : input.parent_expense_level [4,30] else  
<reject or error>
IHTH
Sam
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

ray.wurlod wrote:Why me particularly? :?
Because your everyone's favourite :wink:

Actually you need to put the codes advised by our fellow forum users in a stage variable and for the last value specify a default value like say 'R'.
In the constraint of your target you need to specify
stgvar <> 'R'
and in the constraint for the reject file specify
stgvar = 'R'.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

Code: Select all

If input.expense_level [1,3] <> 'LPG' then input.expense_level else 
if input.expense_level [1,3] = 'LPG' and index(input.expense_level, '*', 1) = 1 then 'NPG' : input.parent_expense_level ['*',1,1] else  
<reject or error> 

little change , Try this

Thanks,
Anupam
Post Reply