To call a shellscript within User Defined Server 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
prem84
Premium Member
Premium Member
Posts: 25
Joined: Sat Jul 03, 2010 11:55 pm
Location: chennai

To call a shellscript within User Defined Server Routine

Post by prem84 »

Hi,
I have a shellscript.
It needs to be called from a user defined subroutine.
How can i do it.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

DSExecute()
-craig

"You can never have too many knives" -- Logan Nine Fingers
prem84
Premium Member
Premium Member
Posts: 25
Joined: Sat Jul 03, 2010 11:55 pm
Location: chennai

Post by prem84 »

But the documentation says DSExecute executes a datastage engine command or a Dos command and no reference to shellscript execution is given
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It executes all kinds of things, including any operating system command and you would specify 'UNIX' as the type for a shellscript rather than 'DOS' (etc). Is your DataStage server actually running on a UNIX box?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The first argument of DSExecute() is the shell in which the command is to execute. It might be "SH" (on UNIX), "DOS" (on Windows) or "UV" (for the UniVerse shell).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah... been awhile, forgot the 'SH' rather than 'UNIX' part.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

execute 'SH -c "unix command" ' capturing output returning ReturnValue
Mamu Kim
prem84
Premium Member
Premium Member
Posts: 25
Joined: Sat Jul 03, 2010 11:55 pm
Location: chennai

Post by prem84 »

Hi all,
Thank you very much now i am able to call the shellscript.
Suppose i need to pass a argument to the DSexecute command from a function i.e.
s = Arg1
Call DSExecute('UNIX','sh check.sh s',Output, SystemReturnCode)
But i am not able to pass the actual value.
Kindly advice.
Last edited by prem84 on Thu Sep 02, 2010 10:59 pm, edited 1 time in total.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

That is because you are giving 's' within quotes which will interpret as a literal string.

Try

Code: Select all

'sh yourShellScript ': s
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

prem84 wrote:Hi all,
Thank you very much now i am able to call the shellscript.
Suppose i need to pass a argument to the DSexecute command from a function i.e.
s = Arg1
Call DSExecute('UNIX','sh check.sh s',Output, SystemReturnCode)
But i am not able to pass the actual value.
Kindly advice.
May be try something like this

Code: Select all

 
vCmd = 'sh check.sh' : s
Call DSExecute('UNIX',vCmd,Output, SystemReturnCode)
Arun
Post Reply