How to write substring option in transformar with if conditi

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
deesh
Participant
Posts: 193
Joined: Mon Oct 08, 2007 2:57 am

How to write substring option in transformar with if conditi

Post by deesh »

Please can help in this canse

if OKCSCD in('DE') then substring(OKCUA4,7, end) else Blank
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then OKCUA4[7,len(OKCUA4)] Else

Or something similar with Right().
-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 »

Code: Select all

If Index("DE", InLink.OKCSCD, 1) Then Right(InLink.OKCUA4, Len(InLink.OKCUA4) - 6) Else ""
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Now, that depends on how you read the 'IN' statement in the OP. As written, it is syntactically equivalent to if OKCSCD = 'DE' but if you read it as if OKCSCD like '*DE*' or that the field contains the substring 'DE' then the Index() is appropriate.
-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 »

Code: Select all

Index("DE", InLink.OKCSCD, 1)
is the same as

Code: Select all

("DE" = InLink.OKCSCD) Or ("D" = InLink.OKCSCD) Or ("E" = InLink.OKCSCD) 
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah... didn't notice you had the arguments 'backwards'. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply