parameterizing the transformation functions

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

parameterizing the transformation functions

Post 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
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: parameterizing the transformation functions

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bamaxplant
Participant
Posts: 12
Joined: Wed Nov 04, 2009 1:24 pm

Re: parameterizing the transformation functions

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: parameterizing the transformation functions

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post 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 .
Nag
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post 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
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

The first level doesn't work.
<param>(args) throws syntax error in transformer itself.
pandeeswaran
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

Nag
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post 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.
Choose a job you love, and you will never have to work a day in your life. - Confucius
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Re: parameterizing the transformation functions

Post 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.
Choose a job you love, and you will never have to work a day in your life. - Confucius
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Thanks for your suggestions!
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

What was the resolution?
Choose a job you love, and you will never have to work a day in your life. - Confucius
Post Reply