Transformer Expression as a Parameter Value

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
vivek_rs
Participant
Posts: 37
Joined: Thu Nov 25, 2004 8:44 pm
Location: Bangalore, Karnataka, India

Transformer Expression as a Parameter Value

Post by vivek_rs »

Hi
The expression that goes into a column definition in a Transformer Stage change at every run.
I know the link name and the field names that go into the expression.
I've constructed the expression elsewhere manually/using another tool.
I need to type it as a Job Parameter.
Is there any way of doing this?
Regards,
Vivek RS
vigneshra
Participant
Posts: 86
Joined: Wed Jun 09, 2004 6:07 am
Location: Chennai

Post by vigneshra »

You can very well use job parameters in the column derivation part in a transformer stage. Keep the generated expression in a file and while calling the job, just pass the expressions as job parameters. Use them in your job based on the need.

Vignesh.
vivek_rs
Participant
Posts: 37
Joined: Thu Nov 25, 2004 8:44 pm
Location: Bangalore, Karnataka, India

Post by vivek_rs »

Hi vigneshra
But it doesn't seem to work!

I have a transformer that has two input columns a and b coming in from a link lnk. The output has a column result. The derivation for result is a job parameter Exp. Now, if I type lnk.a+lnk.b as the value for Exp, all rows in result gets the literal lnk.a+lnk.b[/code]
Regards,
Vivek RS
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

You need CANNOT use job parameters in the way suggested.

Your derivation has to be CODED into the job design. If you have a few expressions, simply use stage variables to derive the result a few difference ways. Then, use a job parameter to act as the switch which decides which derivation to use.

If you have an infinite variation of derivation, then you have to EXTERNALIZE the transformation. DataStage builds compiled programs, you cannot change the logic on the fly. Therefore, using a function that makes an external call side-steps this issue and provides you the functionality you need at a performance cost.

To do what you want to do, and keep performance, make take a little bit of sophistication. You can generate a function on the fly that does your variable derivation. Use it in the job to derive your particular column. Simply create a function that gets all columns potentially required passed as arguments. Then, prior to running your job, programmatically update the function to derive as needed and recompile the function. Since the job uses the function already, it doesn't need to be recompiled. It will take advantage of the new logic.

This is easier that trying to change job logic programmatically, and Transforms, if changed, also require the job to be recompiled. This is probably the easiest thing to do. Your external rules requirement sounds more like you need to be an external rules engine that is more scalable and usable.

Good luck!
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
vigneshra
Participant
Posts: 86
Joined: Wed Jun 09, 2004 6:07 am
Location: Chennai

Post by vigneshra »

Thanks Bland !! I too got to know how to parameterise the derivations. Sorry Vivek, I gave you a wrong information.

Vignesh.
vivek_rs
Participant
Posts: 37
Joined: Thu Nov 25, 2004 8:44 pm
Location: Bangalore, Karnataka, India

Post by vivek_rs »

Thanks a lot guys!
This is working fine.
That helped me a lot...
Regards,
Vivek RS
mtechnocrat
Participant
Posts: 38
Joined: Sat Feb 28, 2004 12:11 pm

Post by mtechnocrat »

Vivek

few days back I have worked in same issue , just paramerize thye link name and give it in job parameters , i think this will be good .

regards

Hari
vivek_rs
Participant
Posts: 37
Joined: Thu Nov 25, 2004 8:44 pm
Location: Bangalore, Karnataka, India

Post by vivek_rs »

Hi
How do you Parameterize a link name?
Regards,
Vivek RS
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

You cannot, another poster just stated the same errant suggestion.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply