Usage of UtilityHashLookup

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
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Usage of UtilityHashLookup

Post by DS_SUPPORT »

Hi All,

I am analysing the routine UtilityHashLookup, so that we can avoid introducing the Hashed File Stage in the Job. I want to know

1) Is there any advantage in using UtilityHashLookup in terms of memory usage ?

2) How the Key Value (Arg2) has to be passed , in case of multiple Keys.
Say i have 3 Key fields K1, K2, K3 and one non-key field NK1 in a Hashed File, and how i need to pass the key value. Is it like

Code: Select all

   K1@VMK2@VMK3
Whether this routine can be used for multiple keys?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

1) No. If anything there is a slight disadvantage.

2) Unless you have specified a different key separator character (and if you don't know how to, you haven't) you separate the column values with text mark characters. In your example the expression would be of the form

Code: Select all

K1 : @TM : K2 : @TM : K3
In particular it is NOT a value mark (@VM).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I only use it when I need to look-up one value and I'd rather do that once rather than over and over, even though there isn't anything wrong with that. Therefore, I use it in the Initial Value section of a stage variable.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Post by DS_SUPPORT »

I tried using

Code: Select all

K1 : @TM : K2 : @TM : K3
But it is not working. Here is my Hashed File Dictionary

Image

And Here is my Hashed File Data

Image

The output from the routine is

Code: Select all

TEST #1
*******
 
Arg1 = HASH_UTILITY_LKP
Arg2 = Anand:@TM:IND:@TM:CS
Arg3 = 
 
Test completed.
 

Result = **RECORD NOT FOUND**
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Unable to view full sized image. "Click here" had no effect. Using IE6.

Can you show as text, between code tags? Or at least the definition of, say, the K1 column?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Post by DS_SUPPORT »

Here is the Dictionary Information

Code: Select all


DICT HASH_UTILITY_LKP    11:51:17  09-02-08  Page    1

               Type &
Field......... Field. Field........ Conversion.. Column......... Output Depth &
Name.......... Number Definition... Code........ Heading........ Format Assoc..

@ID            D    0                            HASH_UTILITY_LK 10L    S
                                                 P
Salary         D    1               MD0          Salary          5R     S
Country        I      FIELD(@ID,@TM              Country         3L     S
                      ,2)
Dept           I      FIELD(@ID,@TM              Dept            2L     S
                      ,3)
Name           I      FIELD(@ID,@TM              Name            5L     S
                      ,1)
@KEY           PH     Name Country
                      Dept
@              PH     Name Country
                      Dept Salary
                      ID.SUP

7 records listed.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can't put an expression on the test grid. It won't be evaluated.

Create your own routine that accepts the three separate values, assembles the key, calls UtilityHashLookup, and reports the result.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Post by DS_SUPPORT »

Thanks Ray, That Solved the Issue.
Post Reply