Database Lookup

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

Post Reply
srinagesh
Participant
Posts: 125
Joined: Mon Jul 25, 2005 7:03 am

Database Lookup

Post by srinagesh »

Hi !

I am having a problem with the Lookups.

Source File has 1 record (recordid)
Lookup Table (RecordId, RecordName, RecordDetails)
Target (File)


I need to read the source file, lookup for values in the LookupTable where LookupTable.RecordId <= SourceFile.RecordID and populate the resultant rows in the Target file.

I have done a search on "Range Lookup", but couldnt find anything that would give a simple way of doing this.

Could you please suggest a way.

Regards
Nagesh
sjhouse
Premium Member
Premium Member
Posts: 43
Joined: Tue Nov 02, 2004 12:11 pm
Location: Minneapolis, MN

Post by sjhouse »

I would reverse the tables and use the table with multiple records as your source table. Use the other record as a lookup with a hard coded Record ID and use the constrants to filter out records you do not need.
srinagesh
Participant
Posts: 125
Joined: Mon Jul 25, 2005 7:03 am

Post by srinagesh »

Hi !


The problem is with defining the constraint

Code: Select all

                        Lookup (Singlerecord)
                                      | lnk2
                                      |
                                      v
Src(multiRecordTable)  ----------> Transformer ---------------> Target
                         lnk1                             lnk3
What do I mention in the "KeyExpression" part of the lookup.
sjhouse
Premium Member
Premium Member
Posts: 43
Joined: Tue Nov 02, 2004 12:11 pm
Location: Minneapolis, MN

Post by sjhouse »

You can hard code the key as a string. If it changes with each run, then take the record (single record item) and write it to a hashed tble with a hard coded key field>

Hashed table with following fields:
Key Field - "Record" (any string to identify the record.
Field 1 - RecordId (from the original table)

Then in your job, put the hashed file key in the KeyExpression "Record"

Make sure you preload the hash table to memory.

Stephen
Post Reply