Page 1 of 1

what is the difference between Routine and Function

Posted: Mon May 08, 2006 12:03 pm
by suresh_dsx
hi guys,

i am really confusing difference between Routine and Function....



Routine --->Returns a value
Function--->dont return a vaule


Routine---->u can call other Routine
Function---->not possible to call other function


the above statments are right or wrong ...

plz tell me difference and difination of those......and also examples of each

Posted: Mon May 08, 2006 12:34 pm
by kcbland
In all programming languages, a function derives a result, whereas a routine does "stuff". Functions always return a result, routines always return a status. Sometimes a routine's status is a result of a calculation.

A situation where you would use a Function is when a value has a special calculation that is lengthy. You would write a function to encapsulate the logic and make it more reusable. An example is a business calculation based on dates, an equation that calculates a mathematical result, an expression that evaluates a series of codes and returns a predetermined answer, etc.

A Routine is almost always used in before/after stage/job activities. These Routines do things like move files, run scripts, etc.

Posted: Mon May 08, 2006 2:39 pm
by ray.wurlod
DataStage server routines are of three kinds.
  • A transform function takes one or more arguments and returns a result. It is intended to be invoked from Transformer stages and Routine activities.

    A before/after subroutine takes precisely two arguments, one input (from the Input Values field), the other output (a flag that indicates whether or not processing is to continue). It is intended to be used from job or active stage properties.

    An "external UniVerse function" is an interlude to a globally catalogued function. It is an alternative to transform functions for sites that have globally catalogued functions.