ExecSH using after-job subroutine

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

ExecSH using after-job subroutine

Post by abc123 »

I have a job activity in a sequencer. I would like to run an after-job subroutine for the job. I am going to use the ExecSh command to run a shell script. A parameter needs to be passed to the shell script. Will I be able to do something like:

execSH("ksh MyShell.ksh Prm1")? How do I pass the parameter?

Thanks.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Select ExecSH from the after job subroutine from the job you want it to run after.
In the Input Value, cd to the location of your script and run your script.

Ex

Code: Select all

cd /script_location; PPMyShell.ksh Prm1
Or you could also an Execute Command sequence in your Job Sequence after the Job Activity , but here you will have to pass the parameters in the "Parameter" text box.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

To run ExecSH itself as the after-job subroutine, simply put the command line argument after the command pathname in the Input Values field.

To call ExecSH from your own routine you need simply add the command line argument to the command line issued.

If you mean "job parameter" here, rather than command line argument, use a job parameter reference (surrounded by "#" characters) following the command pathname in the first case. In the second case, determine the value of the job parameter using DSGetParamInfo() and build the command line using that value.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

ray, I put the following in the Input Value:

ksh scriptname.ksh parameter1

I don't get any error but it doesn't do what it is supposed to do. However, when I copy the string from Director and execute it, it works fine. Any ideas?
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Where does your script reside?
You need to go to that particular directory and then execute it.
cd to that location, then execute your script.(Hope you are doing that)
You dont need the ksh in front of the script, you could just execute it like below

Code: Select all

scriptname.ksh parameter1 
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

Ok. I found the solution. My script did not have a return at the end which was causing this.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

abc123 wrote:Ok. I found the solution. My script did not have a return at the end which was causing this.
I guess you can mark this as resolved now :wink:
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
Post Reply