Lookup - different scenario

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
prematram
Participant
Posts: 14
Joined: Fri Dec 14, 2007 2:01 am
Location: Chennai

Lookup - different scenario

Post by prematram »

Hi,

i need solution for the following scenario:

i am having one main file and reference file. I need to lookup data based on specific value which may be in any column, not based on specific column...

ie in lookup stage what happens is we give a key column with which matched records w.r.t that column is taken as output.

but the secanario here is we have to take matched records based on specific value that may present in any column.

whether this is possible...??
Prem R.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

It is possible. There are a couple of ways you can do this, but the optimal solution depends upon the number of columns and the type of data file (is it a table or a sequential file?) as well as the file size and what database you are using.
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

There are many ways as mentioned earlier, if you happen to present the clear metadata of 'reference file'.(especially, the same Datatype of the Columns, Number of Columns)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Actually, it's not really related to the metadata at all. The requirement, if I read it correctly, is to find a row based on looking for a "search key" value in any column in that row. The only metadata limitation would be one of compatible data types. As Arnd said, the optimal solution will depend on just how many columns (and rows) there are in the reference data, and how those data are stored.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

Correct ray.wurlod,

A small question,
ray.wurlod wrote:....and how those data are stored
Could you please expand - How this can be one of the dependencies?
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

Hi ,

As I understand the problem, the sample data may be like this:

Input data:

IpCol1 Ipcol2
a 1
b 2
c 3
d 4
yy 5

Reference data:
Refcol1 Refcol2 Refcol3 refcol4 ....
a aa aaa aaaa
x b xx xxx
y z c yy

Lets say we are looking up for Ipcol1 of Input data then our output should be
(Ipcol1 is mapped to Opcol1 and Ipcol2 to Opcol2)

Opcol1 Opcol2
a 1
b 2
c 3
yy 5

Please correct me if I am wrong. But still I can't understand how this logic can be implemented?

Thanks
Attitude is everything....
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Short answer - you have more options for being selective with the data if they are in a table compared to if they are in a sequential file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
aakashahuja
Premium Member
Premium Member
Posts: 210
Joined: Wed Feb 16, 2005 7:17 am

Post by aakashahuja »

This is something I would do although I am sure that others would have better ways to suggest on this:

Lets say I have 5 columns in data set to be referenced, say col1, col2, col3,col4,col5.
I would :
1. Concatenate all the columns together using a separator that doesnt exist the data set which is to be looked up. For ex col1@col2@col3@col4@col5.
2. This gives me 1 single column. Now using some string functions, I would find the presence of the source value in the big concatenated string.

Cheers
Aakash
L'arrêt essayant d'être parfait… évoluons.
Post Reply