Page 1 of 2

parameterizing the transformation functions

Posted: Tue Jan 03, 2012 10:39 am
by pandeesh
Today, i have got a question from a developer who is working in Ab Initio.
Can we parameterize the functions?
e.g:
we are using trim(col).
I need to parameterize the trim and get the function in run time.
e.g
something like TRIM_PAR(col).

It's not possible in datastage .

Any thoughts why this feature is not provided?

Thanks

Re: parameterizing the transformation functions

Posted: Tue Jan 03, 2012 2:43 pm
by ray.wurlod
pandeesh wrote:It's not possible in datastage.
Your proof?

I believe it is possible, but I'm not sure what you're asking. Could you provide a concrete example?

Re: parameterizing the transformation functions

Posted: Tue Jan 03, 2012 4:03 pm
by bamaxplant
I think it's not possible because the syntax editor in the transformer derivation won't accept something that looks like <parameter name>(....), which, I think, is what is being asked - i.e. to have the actual function to be called be a parameter.

Re: parameterizing the transformation functions

Posted: Tue Jan 03, 2012 6:42 pm
by chulett
pandeesh wrote:we are using trim(col).
I need to parameterize the trim and get the function in run time.
e.g something like TRIM_PAR(col).
I'm withholding comment until I understand what the above is supposed to achieve. Right now I don't see the point, so much like Ray I'm looking for a better, more concrete example.

Posted: Tue Jan 03, 2012 7:52 pm
by nagarjuna
If I understand it correctly , you are trying to parameterize a function ...Suppose you have rule table which gets populated & depending on the value , you need to either A + B or A - B or A * B . Here the operand between A , B is parameter . I tried this requirement sometime back but didn't do that ..there are couple of posts related to this requirement ..I guess you need search by rule engine keyword ..

Yes in abinitio , you can do it very easily ..when you deploy a graph in abinitio, it's get converted into simple KSH ...In datastage , things are little complicated as it get converted into OSH & C++ compiled code .

Posted: Tue Jan 03, 2012 9:08 pm
by chulett
nagarjuna wrote:If I understand it correctly , you are trying to parameterize a function ...Suppose you have rule table which gets populated & depending on the value , you need to either A + B or A - B or A * B . Here the operand between A , B is parameter .
Not really sure how you drew that conclusion from the 'trim' example posted. So, we wait.

Posted: Tue Jan 03, 2012 9:28 pm
by pandeesh
Yes. Your understanding is correct.
I want to pass the function name as parameter.
In transformer it ll be like, <param>(column).
Th param will be passes at runtime .
It may be trim or upcase.

Thanks

Posted: Tue Jan 03, 2012 9:58 pm
by ray.wurlod
I don't believe that will work, but do try it and let us know.

With only one additional level of redirection it would be easily done.

Code: Select all

GeneralFunction(<param>,<arg-list>)
The general function would incorporate a dispatcher of some kind based on the first argument value.

Posted: Tue Jan 03, 2012 10:02 pm
by pandeesh
The first level doesn't work.
<param>(args) throws syntax error in transformer itself.

Posted: Tue Jan 03, 2012 10:04 pm
by nagarjuna

Posted: Tue Jan 03, 2012 10:44 pm
by qt_ky
Version 8.7 introduces a Data Rules stage. From the description, you would use Information Analyzer to build the rules based on a variety of functions. Then data can pass all rules to validate, fail on one or more rules, etc. I don't think a rule engine is what this topic is about exactly, although it may be implied somewhat.

Re: parameterizing the transformation functions

Posted: Tue Jan 03, 2012 10:50 pm
by qt_ky
pandeesh wrote:Any thoughts why this feature is not provided?
I will take a stab at it... Parallel Transformer code is compiled before run time. Perhaps Ab Initio is interpreted at run time? Back in the day, I was taught that compiled code always performs faster than interpreted code.

Posted: Wed Jan 04, 2012 2:44 am
by pandeesh
Thanks for your suggestions!

Posted: Wed Jan 04, 2012 2:44 pm
by ray.wurlod
Data Rule Definitions can be created in either DataStage or Information Analyzer. They are compatible - rule definitions published into the common metadata repository by one tool can be used by the other.

Posted: Fri Jan 06, 2012 10:39 am
by qt_ky
What was the resolution?