DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
Author Message
kollurianu



Group memberships:
Premium Members

Joined: 06 Feb 2004
Posts: 614

Points: 5283

Post Posted: Fri Mar 07, 2008 3:28 pm Reply with quote    Back to top    

DataStage® Release: 7x
Job Type: Server
OS: Unix
Additional info: Convert function
Hi All,

I have the following expression for input values ...CAL AND LTR the result is Y instead of N , can anybody explain why ,
am I missing something.

If (Index(Convert(",",@FM,"CALA,LTRA,OOARCAL,OOARLTR,OOAY"), dedup_etn.CPNI_DATA_STRING ,1 ) <> 0 ) Then 'Y' Else If (Index(Convert(",",@FM,"CAL,CALF,GEN,LTR,LTRF,MCH,MCHA,MCHF,MCHT,OOADCAL,OOADLTR"), dedup_etn.CPNI_DATA_STRING , 1) <> 0) Then 'N' Else 'D'

Thanks you to you all in advance.
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 43085
Location: Denver, CO
Points: 222463

Post Posted: Fri Mar 07, 2008 3:34 pm Reply with quote    Back to top    

Because the Index function finds 'CAL' in 'CALA' and 'LTR' in 'LTRA'.

_________________
-craig

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

Last edited by chulett on Fri Mar 07, 2008 3:58 pm; edited 1 time in total
Rate this response:  
Not yet rated
ds_developer



Group memberships:
Premium Members

Joined: 24 Sep 2002
Posts: 224
Location: Denver, CO USA
Points: 1253

Post Posted: Fri Mar 07, 2008 3:56 pm Reply with quote    Back to top    

I don't see it as an issue with Convert, it is Index that is giving you that answer. The convert is giving you:

"CALA@FMLTRA@FMOOARCAL@FMOOARLTR@FMOOAY"

Index is looking for the first occurance of CAL - well it is in there so you get Y.

You need to rethink the routines to use or let us know more about what you want to accomplish.

John
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 43085
Location: Denver, CO
Points: 222463

Post Posted: Fri Mar 07, 2008 3:59 pm Reply with quote    Back to top    

Yes, exactly. Edited my response to make that more obvious. Wink

_________________
-craig

"You can never have too many knives" -- Logan Nine Fingers
Rate this response:  
Not yet rated
kollurianu



Group memberships:
Premium Members

Joined: 06 Feb 2004
Posts: 614

Points: 5283

Post Posted: Fri Mar 07, 2008 4:01 pm Reply with quote    Back to top    

Thanks for the responses..

Well what i need to be done is

only when the exact matches of the strings are found ..want the decoding to be done.

so any suggestions for accomplishing that.

Thanks all.
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 43085
Location: Denver, CO
Points: 222463

Post Posted: Fri Mar 07, 2008 4:50 pm Reply with quote    Back to top    

Put something around each occurance in the list to check againts and then do the same for the value you need to check so they become unique, like single quotes. For example: Code: If (In ...

_________________
-craig

"You can never have too many knives" -- Logan Nine Fingers
Rate this response:  
Not yet rated
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 54601
Location: Sydney, Australia
Points: 296091

Post Posted: Fri Mar 07, 2008 5:28 pm Reply with quote    Back to top    

Given that this is a server job, the ideal solution would be routine containing a Locate statement.

_________________
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 43085
Location: Denver, CO
Points: 222463

Post Posted: Fri Mar 07, 2008 5:35 pm Reply with quote    Back to top    

Ah yes, Locate. Exact match without all the fuss. Wink

_________________
-craig

"You can never have too many knives" -- Logan Nine Fingers
Rate this response:  
Not yet rated
kollurianu



Group memberships:
Premium Members

Joined: 06 Feb 2004
Posts: 614

Points: 5283

Post Posted: Mon Mar 10, 2008 11:50 am Reply with quote    Back to top    

chulett wrote:
Put something around each occurance in the list to check againts and then do the same for the value you need to check so they become unique, like single quotes. For example:

Code:
If (Index(Convert(",",@FM,"'CALA','LTRA','OOARCAL','OOARLTR','OOAY'"), "'":dedup_etn.CPNI_DATA_STRING:"'",1 )) Then 'Y' Else If (Index(Convert(",",@FM,"'CAL','CALF','GEN','LTR','LTRF','MCH','MCHA','MCHF','MCHT','OOADCAL','OOADLTR'"), "'":dedup_etn.CPNI_DATA_STRING:"'", 1)) Then 'N' Else 'D'

If it makes it more obvious what's going on, use an asterisk instead. There's probably better ways to do this but it should work. And ps, your Convert isn't really buying you anything as it doesn't need the Field Marks to function properly.



I modified my expression the following way

If (Index(" 'CALA','LTRA','OOARCAL','OOARLTR','OOAY' ", "'":dedup_etn.CPNI_DATA_STRING:"'",1 )) Then 'Y' Else If (Index("'CAL','CALF','GEN','LTR','LTRF','MCH','MCHA','MCHF','MCHT','OOADCAL','OOADLTR'", "'":dedup_etn.CPNI_DATA_STRING:"'", 1)) Then 'N' Else 'D'

as I understood from your message that "convert" is not needed in there. all I want is to match the string exactly. And also I have 2 million rows coming in which would be an unneccasary over head ..

Both the above expressions worked fine.. for LTR and CAL ..


Thank you all very much for the responses.
Rate this response:  
Not yet rated
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 54601
Location: Sydney, Australia
Points: 296091

Post Posted: Mon Mar 10, 2008 4:03 pm Reply with quote    Back to top    

kollurianu wrote: I want is to match the string exactly. And also I have 2 million rows coming in which would be an unneccasary over head .. No, a necessary overhead. This is processin ...

_________________
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours