how to satisfy for unkown incoming data for multiplescenario

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
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

how to satisfy for unkown incoming data for multiplescenario

Post by marpadga18 »

Hi all
I have input.column. I need to satisfy this on both conditions any idea?

"Parse all value after the string literal i.e. LFA1 or VENDOR,
e.g.
source_data Target data
~LFA1~0005002430~ outputwould be 0005002430
~VENDOR~33940~ outputwould be 33940
~VENDOR~217~1095-1~ outputwould be 217~1095-1
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Assuming these are the only two possibilities, use substring operators to extract all except the prefix, then trim leading and trailing tilde characters from the result.

Code: Select all

Trim(If Left(InLink.TheString,5) = "~LFA" Then InLink.TheString[6,Len(InLink.TheString)-5] Else InLink.TheString[8,Len(InLink.TheString)-7],"~","B")
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 »

So... how accurate is your example data? Are you literally looking for just "LFA1" or "VENDOR" or does it not really matter what value the "literal string" contains? Can this requirement boil down to just taking everything after the second "~" in the string?

If so a simple Field() function will do the trick:

Code: Select all

Field(InputColumn,"~",1,999)
After that you'd just need to remove the trailing "~".
-craig

"You can never have too many knives" -- Logan Nine Fingers
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

chulett wrote:So... how accurate is your example data? Are you literally looking for just "LFA1" or "VENDOR" or does it not really matter what value the "literal string" contains? Can this requirement boil ...
Hi chulett,

The literal string will be LFA1 and VENDOR only not other than this. Only 2 posibilities
Last edited by marpadga18 on Mon Aug 20, 2012 5:07 pm, edited 4 times in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Andrew?
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 »

Andrew's not here man.
-craig

"You can never have too many knives" -- Logan Nine Fingers
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

Sorry its my mistake could give some derviation for the above
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

We both did.
-craig

"You can never have too many knives" -- Logan Nine Fingers
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

chulett wrote:We both did.
I said sorry
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Re: how to satisfy for unkown incoming data for multiplescen

Post by marpadga18 »

it worked partially for vendor it worked fine but LFA1 it brought the output with 1 and then the data? how to resolve this




source_data Target data
~LFA1~0005002430~ outputwould be 10005002430
~VENDOR~33940~ outputwould be 33940
~VENDOR~217~1095-1~ outputwould be 217~1095-1
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Re: how to satisfy for unkown incoming data for multiplescen

Post by marpadga18 »

after this I did the substring it worked fine thanks for your idea.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

marpadga18 wrote:
chulett wrote:We both did.
I said sorry
I'm not quite sure what you think went on here, but there was no anger or issue with the wrong name being used. Heck, my reply was an obtuse reference to an old Cheech & Chong bit which is only funny if you're old like me.

All I was saying in response to your "give some derviation" post was to reiterate that both Ray and I had already done just that: posted two different approaches to solving your issue. Neither of which for the record involved using Convert(), that was an... interesting... solution. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Would have to be one of the most obscure discussions going...

And now that I put "Andrew's not here man" in Cheech's voice that makes a lot more sense too, I did wonder what you were on (literally) when I first read that.

As for the solution... I'm with you... it lost me but if he's happy with the result I won't look much further in to it
Post Reply