Page 1 of 1

SDK Transform Calling

Posted: Thu Sep 22, 2005 6:17 am
by snassimr
Hi !

I need to run Transform from SDK Library of DS from my routine.

How I need to declare it in my routine?

Some examples ?

Posted: Thu Sep 22, 2005 6:45 am
by rleishman
The transform you want to use almost certainly references an SDK routine of the same name. So rather than referencing the transform from your routine, what you really want is probably to reference the underlying routine.

If I'm wrong and the transform you want is just a simple one-liner that doesnt reference a routine then I think you're out of luck. I've tried and failed too. I suspect that transforms may only be used from within transformer stages.

Back on track though... If I'm right and there is an underlying SDK routine, you need a declaration at the top of your routine. Here's an example I pinched from another thread in this forum:

DEFFUN OpenTextFile(Name, OpenMode, WriteMode, Logging) Calling "DSU.OpenTextFile"

If your SDK function is called BiteMe and takes 3 args, you could declare it as follows:

DEFFUN BiteMe(A,B,C) Calling "DSU.BiteMe"

The names of the parameters are not important - but they can give the future reader an insight into what the routine does with going and opening it.

Posted: Thu Sep 22, 2005 7:17 am
by chulett
rleishman wrote:I suspect that transforms may only be used from within transformer stages.
Your suspicions are correct. It's just a snippet of derivation code that's substituted in by the compiler at compile time.

Snassimr, open up the transform and use that snippet in your routine... follow the DEFFUN advice that rleishman outlined if it references a custom routine.

Posted: Thu Sep 22, 2005 4:26 pm
by ray.wurlod
Transforms are pre-stored expressions. They are not callable. If you use them in Transformer stages then inspect the generated code, you will see that they are replaced by their defining expression; that is, the expression becomes in-line code.

It follows that the response suggesting DEFFUN is way off the mark. Note, too, that SDK routines are not cataloged with a "DSU." prefix; most are cataloged with an all upper-case name that has a "DSX." prefix.

It's also unfortunate that DataStage terminology can be confusing; a Transform is different from a transform function (which is a Routine) and they're both different from a Transformer (which is a stage type).