Calling ExecSh from another routine

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
tonystark622
Premium Member
Premium Member
Posts: 483
Joined: Thu Jun 12, 2003 4:47 pm
Location: St. Louis, Missouri USA

Calling ExecSh from another routine

Post by tonystark622 »

Is it possible to call ExecSh from a "regular" (not Before/After) routine? If so, what do I have to put in the DefFun statement to do this?

Thanks,
Tony
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Could you not use DSExecute instead? What are you trying to run, Tony?
-craig

"You can never have too many knives" -- Logan Nine Fingers
tonystark622
Premium Member
Premium Member
Posts: 483
Joined: Thu Jun 12, 2003 4:47 pm
Location: St. Louis, Missouri USA

Post by tonystark622 »

Yep, I can and did. I just didn't remember it till after I posted. :oops:

Tony
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

But, if you really, really wanted to, you'd need an appropriate DEFFUN declaration

Code: Select all

DEFFUN ExecSH(InputArg, ErrorCode) Calling "DSU.ExecSH"
ExecSH is in DSU (not DSD or DSG) because it is supplied as an example of user-written before/after routine.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
tonystark622
Premium Member
Premium Member
Posts: 483
Joined: Thu Jun 12, 2003 4:47 pm
Location: St. Louis, Missouri USA

Post by tonystark622 »

That's what I thought too, Ray.

When I call that routine using the DefFun that you supplied, I get:
Program "DSU.UnixCmdTest": Line 11, Unable to open the operating system file "DSU_BP.O/ExecSH".
My code is:

Code: Select all

FUNCTION UnixCmdTest(Arg1)
DEFFUN ExecSH(InputArg, ErrorCode) Calling "DSU.ExecSH"

Cmd = ""
RetCode = ""

Cmd = "pwd"

Call ExecSH(Cmd, RetCode)

Ans = RetCode
RETURN(Ans)
Tony
Post Reply