Lookup in a Range

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
jo8712
Participant
Posts: 12
Joined: Tue Nov 04, 2003 7:41 am

Lookup in a Range

Post by jo8712 »

I'm trying to load a table with a particular acct_nbr and I need to find(lookup) the acct number in a table that has a range of numbers. The table actually has begin and end range columns and the acc_nbr I have will fall in a range.

I tried using an IF statement to do my join(lookup) in the transformer:

If ACCT.ACC >= LKUP.ACCT_BEGIN AND ACCT.ACC <= LKUP.ACCT_END Then ACCT.ACC Else 'NOT FOUND'

but it is not working.....any suggestions.
1stpoint
Participant
Posts: 165
Joined: Thu Nov 13, 2003 2:10 pm
Contact:

Alternative

Post by 1stpoint »

One alternative is to make a hash file of all the possible account numbers between the ranges and make it a key, e.g.

Account Number Range Returned Account
123-145 145

Key Returned Account
123 145
124 145
125 145
...

The other alternative would be to use the UV stage, which may be a tad slower on the lookup side depending on the volume of transactions.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This exact question has been answered a number of times on the forum.
Try a search for "BETWEEN JOIN" as a start point.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply