Calling Routine though varibale

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
shershahkhan
Participant
Posts: 64
Joined: Fri Jan 25, 2008 4:41 am

Calling Routine though varibale

Post by shershahkhan »

I want to call a routine from another routine and the name and parameters of the first routine is passed as parameter value.

Code: Select all

After Routine: FirstRoutine - SecondRoutine(0,0); ThridRoutine(0,0)
INSIDE Routine

Code: Select all

fRoutine= Field(InputArg, ";", 0, 1) ;
sRoutine= Field(InputArg, ";", 1, 1) ;

CALL DSU.fRoutine;
CALL DSU.sRoutine;
Can we do this
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Post by DS_SUPPORT »

Yes , you can do that. Define the first routine inside the second routine, by using DEFUN.

Code: Select all

DEFFUN FirstRoutine(Arg1) Calling "DSU.FirstRoutine"
And then in your code, you can just get the values like

Code: Select all

    TVar = FirstRoutine(SomeVal) 
Or If this doesnt solve your purpose, Ray Recently posted some routines which work for Rule based. Search For the String '@RuleSubr"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes.

You use "indirect call", which allows the value of the routine name to be loaded into a variable before the CALL statement is executed.

Find out more from the DataStage BASIC manual. You will also find examples if you Search DSXchange.
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