Page 1 of 1

DSExecute

Posted: Mon Nov 03, 2003 9:50 am
by GABRIEL
With DataStage on a NT server.
I use the DSExecute command.
To run a shell script on a UNIX server.

DSExecute Command = rsh hpserv -l user test

shell script test = echo "end"

In the return of the command DSExecute
Output="Terminel handle"

I do not obtain the message return from test script " End "


Thanks

Posted: Mon Nov 03, 2003 10:04 am
by Amos.Rosmarin
Hi,

Can you run your command from a cmd window ? if so, there should be no problem doing the same from DSExecute.... it worked for me.

To run RSH you must do some things in the unix like have an entry in the .hosts etc....


Amos

Posted: Mon Nov 03, 2003 11:27 am
by kcbland
You have to first test that the command works. I recommend wrapping it all in a single script local to the DataStage server. Avoid as much command line full syntax execution as possible, because you will have difficulty passing strings with quotes from DataStage to the command line.

Run the command line shell script that does the rsh logic. You must keep in mind that your telnet session has to happen from the DataStage server, as well as be done under the logic of the userid from which the job executes.

Once you have this working, the last piece in the puzzle will be the environment issues that separate a command line execution from a DataStage issuing the command line execution.

Good luck!

Posted: Mon Nov 03, 2003 3:53 pm
by ray.wurlod
To be more helpful, we would need to see the exact syntax of your call to DSExecute, along with prior statements that assign values to any variables used within the call, and subsequent statements that access values returned by subroutine arguments.

Posted: Mon Nov 03, 2003 4:09 pm
by mfortuna
you will also need a Call before the DSExecute.

I typically use the same invocation of DSExecute all the time:
First, test your command in unix. Then in your routine, paste the following lines for your invocation, with your tested command in the quotes (use escape chars for embedded quotes):


cmd = "rsh hpserv -l user test"
Call DSExecute("UNIX", cmd, output, systemreturncode)

ErrorCode = systemreturncode ;* optional to return value

Posted: Mon Nov 03, 2003 4:28 pm
by kduke
Try:

cmd = 'rsh "hpserv -l user test" '

Kim.

Posted: Mon Nov 03, 2003 4:46 pm
by mfortuna
on Solaris the rsh syntax is:

rsh -l user hpserv test

I think it is the same on HP. It will error out if you put the user param after the host.

Posted: Tue Nov 04, 2003 2:06 am
by Amos.Rosmarin
Your datastage server is running on a WINDOWS NT system so your DSExecute command should look like this:


cmd = "rsh hpserv -l user test"
Call DSExecute("NT", cmd, output, systemreturncode)

RSH (in this case) is a windows command.


Amos

Posted: Wed Nov 05, 2003 9:24 am
by roy
Hi,
After all the replies from all the nice people,
a reply to your question :!:
the command you run is rsh there for the only thing you will get is the output and return code of the rsh command itself and nothing from the scripts/commands or whar ever rsh runs.

If you need to get info on them try to transfer the things you want into files (simple redirection might not be so simple) once you have the data you need in files simply check them after rsh finishes.


IHTH (I Hope This Helps)