Write and Read the same hash file in same job?

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
Desigal24
Participant
Posts: 2
Joined: Thu May 11, 2006 12:12 pm

Write and Read the same hash file in same job?

Post by Desigal24 »

i am writing to a hash file first and in the second transformer i read from it for a lookup. I dont have any caching enabled for the hashfile.
Will this work? will all the records be written successfully before the read operation begins?
ANY HELP IS APPRECIATED.

---------- ------- ------- -----------
ORAOCI ---> TXFR ----> TXFR ----> Seqfile
---------- ------- ------- -----------
| /\
V |
----------- -----------
Hash file Hash file
------------ -----------
Thanks,
G
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

We really should have a better picture of your job to give you a proper answer. Wrap your ascii art in 'code' tags so that spacing is preserved. Make liberal use of the 'Preview' function to ensure it all lines up properly. Keep at it until you get something usable.

Then we can talk. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It will work, provided you don't use caching for read or write. Also enable lock for update. It is essential that you use separate Hashed File stages; add an annotation warning future developers that the two stages refer to the same hashed file (not hash 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Write and Read the same hash file in same job?

Post by chulett »

Code: Select all

-------    -------     -------     -----------
ORAOCI ---> TXFR  ----> TXFR  ----> Seqfile
-------    -------     -------     -----------
            |              /\
            V              |
         -----------  -----------
         Hash file    Hash file
         -----------  -----------   
Ok, there's my hack of your ascii art. :roll:

Depending on what you mean by 'work' the answer is either yes or no. Yes, a record written in the first xform will be available for lookup in the second - if you follow Ray's advice.

If work is related to your second question - then no. DataStage will process a record from source to target before the second record starts its journey. So, no, not all records will be written to the hashed file before the read operation begins. Is that what you need? All writes before all reads? Not sure that makes sense, if that's what you need please explain your requirements...
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Usually there's an extra step, to pre-populate the hashed file from the target table.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Re: Write and Read the same hash file in same job?

Post by sb_akarmarkar »

Desigal24 wrote:i am writing to a hash file first and in the second transformer i read from it for a lookup. I dont have any caching enabled for the hashfile.
Will this work? will all the records be written successfully before the read operation begins?
ANY HELP IS APPRECIATED.

---------- ------- ------- -----------
ORAOCI ---> TXFR ----> TXFR ----> Seqfile
---------- ------- ------- -----------
| /\
V |
----------- -----------
Hash file Hash file
------------ -----------
Thanks,
G
Yes, It works better dont enable caching.

Thanks,
Anuapm
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

Do you think the order of the output links in the first transform stage is important? If so, I suggest you order your output links to ensure that the write to the hashed file occurs before the passing of the row from the first transform to the second.
Post Reply