what is the difference between Routine and Function

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
suresh_dsx
Participant
Posts: 160
Joined: Tue May 02, 2006 7:49 am

what is the difference between Routine and Function

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply