Page 1 of 1

To call a shellscript within User Defined Server Routine

Posted: Mon Aug 30, 2010 6:48 am
by prem84
Hi,
I have a shellscript.
It needs to be called from a user defined subroutine.
How can i do it.

Posted: Mon Aug 30, 2010 6:48 am
by chulett
DSExecute()

Posted: Mon Aug 30, 2010 6:53 am
by prem84
But the documentation says DSExecute executes a datastage engine command or a Dos command and no reference to shellscript execution is given

Posted: Mon Aug 30, 2010 7:11 am
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?

Posted: Mon Aug 30, 2010 5:53 pm
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).

Posted: Mon Aug 30, 2010 8:32 pm
by chulett
Ah... been awhile, forgot the 'SH' rather than 'UNIX' part.

Posted: Tue Aug 31, 2010 4:45 am
by kduke
execute 'SH -c "unix command" ' capturing output returning ReturnValue

Posted: Thu Sep 02, 2010 7:20 am
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.

Posted: Thu Sep 02, 2010 7:29 am
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

Posted: Wed Sep 08, 2010 10:53 am
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)