Lookup not matching

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

satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Lookup not matching

Post by satya99 »

I have a source Hashed file

ex:

No1(key) No2 no3

100~8~T 205
100~9~T 305 405

I need to perform a look up against the same hashed file.

So i created a new hashed file from the source and split the key into


Noa(Key) Nob(Key) Noc(Key) No2 no3

100 8 T 205
100 9 T 305 405


Now i am performing a lookup.

when ever there is a match on 100~8~T then i need to have the same value 205 in 100~9~T(no3) so that my output should look like

ex:

No1(key) No2 no3

100~8~T 205
100~9~T 305 205(Changed from 405 to 205)

Any advice

Thanks in advance

** Note: Subject changed to be more descriptive - Content Editor**
satya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Do the lookup. If it is not found, make no change. If it is found, make the change.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Post by satya99 »

When i find a match on 100~8~T then i need to use value in no2 column i.e 205 and drop it in no3 column of 100~9~t(cross reference)


No1(key) No2 no3

100~8~T 205
100~9~T 305 405

Noa(Key) Nob(Key) Noc(Key) No2 no3

100 8 T 205
100 9 T 305 405

o/p

No1(key) No2 no3

100~8~T 205
100~9~T 305 205(Changed from 405 to 205)
satya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yeah. I understood that and provided the solution.

Code: Select all

If RefLink.NOTFOUND Then InputLink.TheValue Else RefLink.TheValue
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Post by satya99 »

Here is the output

No1(key) No2 no3

100~8~T 205 205(changed from '' to 205 aswell) this should not happen
100~9~T 305 205(Changed from 405 to 205)
satya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Post your actual derivation expressions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Post by satya99 »

IF lkp.NOTFOUND THEN scr.no ELSE lkp.no

I created the look up from the source, am i supposed to do that?
satya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In your original question you stated that you had already created the hashed file so I took it as given.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Post by satya99 »

Well i created hashed file from source and doing a look up, but i am not getting the expected result.
satya
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then it seems you're not populating your keys properly for the lookup. And that can include something as simple as trimming trailing spaces in your incoming values.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

Satya, Can you explain your requirements with more than 2 rows with different values for the key?
Kandy
_________________
Try and Try again…You will succeed atlast!!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, can you please provide examples of what you get from the lookup (the unexpected result) and examples of what your "expected result" would be in that case. Also, "View Data" on your hashed file and ensure that it looks like you've built it properly - as expected. Click inside the key values in the browser to ensure there's nothing tripping you up like trailing spaces there rather than in your incoming data.
-craig

"You can never have too many knives" -- Logan Nine Fingers
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Post by satya99 »

Source is hashed file.

ex:

No1(key) No2 no3

combination 1

100~8~T 205
100~9~T 305 405

combination 2

200~7~T 101
200~9~T 201 202

This is how the output should loook like:

combination 1

100~8~T 205
100~9~T 305 205 (cross ref)


combination 2

200~7~T 101
200~9~T 201 101 (cross ref)
satya
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

Satya, To be more precise...

Your source hash file (1 file) contains data like this

100~8~T 205
100~9~T 305 405
200~7~T 101
200~9~T 201 202

And you want output like shown below in one target file?

100~8~T 205
100~9~T 305 205
200~7~T 101
200~9~T 201 101

So you are using the first part (100 or 200) to differentiate the combination?
Kandy
_________________
Try and Try again…You will succeed atlast!!
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Post by satya99 »

yes,
satya
Post Reply