1. I dont want to run a job, if it is in aborted state. I need to trap this before executing 'dsjob' from command prompt.
2. Also, I want to detect that job have been completed successfully, & need to trap that code, that the job has finished.
Can anyone has idea, how we can achieve this?
How can I trap the status from dsjob?
Moderators: chulett, rschirm, roy
How can I trap the status from dsjob?
Thanks with regards,
videsh.
videsh.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
First call is to dsjob with -jobinfo. This returns the status. You can then make the decision about whether to use the -run option (perhaps with run mode RESET?).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
In other words, a shell script 'wrapper' that does all this before actually running the job for real. All kinds of checking can go on.
As Ray noted, first thing is to use -jobinfo to check the current status of the job - including if it even exists. If the job needs to be reset, another call to dsjob with the -run -mode RESET that Ray mentioned will do the trick.
Running the job with the -wait option will cause the command to wait until the job finishes before moving to the next step. I prefer using the -jobstatus option instead as it does the same waiting but returns 'DataStage codes': 1 = Ok, 2 = Warnings, 3 = Aborted, etc.
We also shift through the parameters passed to the wrapper script to build the appropriate -param statements the job may need.
Try running jobs with various variations of these commands yourself from the command line so you'll become familiar with what they return, good and bad. That way you'll know what to trap.![Wink :wink:](./images/smilies/icon_wink.gif)
As Ray noted, first thing is to use -jobinfo to check the current status of the job - including if it even exists. If the job needs to be reset, another call to dsjob with the -run -mode RESET that Ray mentioned will do the trick.
Running the job with the -wait option will cause the command to wait until the job finishes before moving to the next step. I prefer using the -jobstatus option instead as it does the same waiting but returns 'DataStage codes': 1 = Ok, 2 = Warnings, 3 = Aborted, etc.
We also shift through the parameters passed to the wrapper script to build the appropriate -param statements the job may need.
Try running jobs with various variations of these commands yourself from the command line so you'll become familiar with what they return, good and bad. That way you'll know what to trap.
![Wink :wink:](./images/smilies/icon_wink.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Chulette
I am not able to locate -jobstatus, as an option to dsjob. Let me share the command what I gave :
dsjob -server $server -user $user -password $password -jobstatus DSRepName DSJobName
I am getting - Invalid/unknown primary command switch.
We have requirement, to wait until job finishes & retirieve the status.
I am not able to locate -jobstatus, as an option to dsjob. Let me share the command what I gave :
dsjob -server $server -user $user -password $password -jobstatus DSRepName DSJobName
I am getting - Invalid/unknown primary command switch.
We have requirement, to wait until job finishes & retirieve the status.
Thanks with regards,
videsh.
videsh.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: