File Operations in Parallel routine

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
piyu
Participant
Posts: 52
Joined: Thu Jul 21, 2005 12:22 am
Location: Singapore

File Operations in Parallel routine

Post by piyu »

Hi,

I need to read a file, populate an array and perform a lookup using that array as part of a routine which will be called per record in a transformer. I haven't used routines before. I would like to know if it is advisable to do file operations in a routine. Also, will the entire routine be executed for every row, specifically if the file operation will be performed for every row or only once to populate array.

Also, will it be better if i do the file read and populate array in before routine and then use the array in the routine for each row. Can that array created in before routine be accessed in the per record routine and if yes, how?
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi and welcome aboard :),
If your talking Parallel Job why not build a lookup file and perform a lookup on it (instead of array in a routine)?

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
piyu
Participant
Posts: 52
Joined: Thu Jul 21, 2005 12:22 am
Location: Singapore

Post by piyu »

No, i cannot use a lookup stage. the lookup is like this : first lookup based on 2 fields. If it fails then, default the second feild n do a lookup again on same file. this would mean two lookup file stages and transformers. Thats why was thinking of using a routine. Any ideas pls help...
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

And having a reject link going to a modify stage to handle_null() and another lookup?
This will result in 2 links that you can eventually load in the logic suiting you.

The specific job design has several variations to implement this idea, simply choose the one that suites you.

IHTH,
Last edited by roy on Mon Apr 03, 2006 4:55 am, edited 1 time in total.
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
jasper
Participant
Posts: 111
Joined: Mon May 06, 2002 1:25 am
Location: Belgium

Post by jasper »

I cannot read the premium content, so sorry if this is a repeat.

You can do this in one lookup followed by a transform. Just do the both lookups to the file, so once on 2 keys, once on one key and a default. In the following transformer you put in logic: if lookup1 isnull then lookup2 else lookup1.
piyu
Participant
Posts: 52
Joined: Thu Jul 21, 2005 12:22 am
Location: Singapore

Post by piyu »

Can u please elaborate. I too dont have access to premium content.

Do u mean use two lookup stages or only one in which u do 2 lookups : once using both keys n second time using one key and a default? How is this done? Performing 2 lookups in one lookup stage? Or am i missing somethig here?
jasper
Participant
Posts: 111
Joined: Mon May 06, 2002 1:25 am
Location: Belgium

Post by jasper »

I mean one lookup stage that does both lookups.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

It may not be directly possible using single lookup stage. But by knowing you exact requirement, like what sort of data is to be looked up, what are the ranges of the discretion of data... the lookup table can be loaded with some manipulation so that a single column can be maintained to lookup. Else as suggested, reject the records and do another lookup and use modify stage to handle_null().
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The Lookup stage can perform conditional lookups.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
piyu
Participant
Posts: 52
Joined: Thu Jul 21, 2005 12:22 am
Location: Singapore

Post by piyu »

Its done! :) Implemented by splitting th e cross ref file into 2 : all the rows wid default value for second lookup column put in second file and then pull values from the 2 datasets. One will correspond to actual value and second to default. Chk in following transformer which is the required combination.

Thanks all for ur help :)
Post Reply