Page 1 of 1

transforms functions and routines

Posted: Wed Mar 16, 2005 2:31 pm
by kollurianu
Hi All,

Can some one tell me what is difference in Transform Function and
Function from Routine Category.

What is the main difference between Transforms and Routines?

Please Asap.

Thank you

Posted: Wed Mar 16, 2005 2:37 pm
by chucksmith
The main difference is that transform functions are substituted at code generation time, whereas routines are called at execution time.

If you can easily do something in a transform function, you may see a performance benefit versus implementing the same task as a routine, since you are eliminating the overhead of the call.

Posted: Wed Mar 16, 2005 2:38 pm
by kcbland
Transforms are just 1 line DS BASIC logic that can be used inside your job in a derivation or constraint expression. When pre-compiling, the Transform name is expanded to the full logic expression stored. This means that if you change the logic in a Transform, all jobs using it must be recompiled.

A Function is a separate code-object that can be extended, expanded, revised, etc, without requiring recompiling jobs that use it. It also has the ability to be many lines long, has an excellent Test facility, as well as has the ability to do much with the rich DS BASIC language.

Use the one that works best for you. Someone will tell you that Transforms are faster because they are not Functions, and that is true if you compare a one line Function against a Transform. But, a 30 line Function can't be done in a Transform.

Use your judgement.

Posted: Wed Mar 16, 2005 4:06 pm
by Sainath.Srinivasan
Transform is in-line function whereas Routine is external call for each row.

Posted: Thu Mar 17, 2005 8:39 am
by kollurianu
Thank you all for ur answers.