Run and Reset if Required
Moderators: chulett, rschirm, roy
Run and Reset if Required
Hi everybody,
I am using dsjob command to run Datastage Jobs.
Online Manual doesnot refer anything regarding the parameter which should be used for running the job with 'Run and Reset if required' Option using dsjob.
We have a '-mode' option but this has only three options : NORMAL,RESET,VALIDATE
But my requirement is to run a job with 'RUN and RESET if required' which we got in Datastage Designer.
And also please tell me how to use more than one parameter in dsjob command.
Do we have to comma(,) between different parameters?
Thanks in Advance
Arun
I am using dsjob command to run Datastage Jobs.
Online Manual doesnot refer anything regarding the parameter which should be used for running the job with 'Run and Reset if required' Option using dsjob.
We have a '-mode' option but this has only three options : NORMAL,RESET,VALIDATE
But my requirement is to run a job with 'RUN and RESET if required' which we got in Datastage Designer.
And also please tell me how to use more than one parameter in dsjob command.
Do we have to comma(,) between different parameters?
Thanks in Advance
Arun
Arun Verma
While multiple parameters *can* be on the command line, you can only use one mode at a time. To emulate the 'Reset if Required then Run' functionality of Sequence jobs, you'll need a script that does 3 things:
1. Checks the status of the job to be run
2. If the job is in an Aborted state, issue the RESET dsjob command
3. Then issue the actual dsjob NORMAL command to run the job
Searching should return at least two complete examples of scripts that do that posted here, from what I recall. Perhaps even a Windows .bat example as well, not certain, but whatever you find can certainly be adapted.
You can also examine the job control code any Sequence job with a Job Activity stage using that option has generated to see how it's done with BASIC.
1. Checks the status of the job to be run
2. If the job is in an Aborted state, issue the RESET dsjob command
3. Then issue the actual dsjob NORMAL command to run the job
Searching should return at least two complete examples of scripts that do that posted here, from what I recall. Perhaps even a Windows .bat example as well, not certain, but whatever you find can certainly be adapted.
You can also examine the job control code any Sequence job with a Job Activity stage using that option has generated to see how it's done with BASIC.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
dsjob with option "RESET IF REQD THEN RUN"
Use following code in .bat file. First command resets the job in any state and resetting a job takes few seconds. Then second command runs it.
C:\myserver\APPS\Ascential\DataStage\Engine\bin\dsjob -server myserver -user myuser -password mypassword -run -wait -mode RESET myproject myjob
C:\myserver\APPS\Ascential\DataStage\Engine\bin\dsjob -server myserver -user myuser -password mypassword -run -wait -mode NORMAL myproject myjob
C:\myserver\APPS\Ascential\DataStage\Engine\bin\dsjob -server myserver -user myuser -password mypassword -run -wait -mode RESET myproject myjob
C:\myserver\APPS\Ascential\DataStage\Engine\bin\dsjob -server myserver -user myuser -password mypassword -run -wait -mode NORMAL myproject myjob
dsjob with option "RESET IF REQD THEN RUN"
Use following code in .bat file. First command resets the job in any state and resetting a job takes few seconds. Then second command runs it.
C:\myserver\APPS\Ascential\DataStage\Engine\bin\dsjob -server myserver -user myuser -password mypassword -run -wait -mode RESET myproject myjob
C:\myserver\APPS\Ascential\DataStage\Engine\bin\dsjob -server myserver -user myuser -password mypassword -run -wait -mode NORMAL myproject myjob
C:\myserver\APPS\Ascential\DataStage\Engine\bin\dsjob -server myserver -user myuser -password mypassword -run -wait -mode RESET myproject myjob
C:\myserver\APPS\Ascential\DataStage\Engine\bin\dsjob -server myserver -user myuser -password mypassword -run -wait -mode NORMAL myproject myjob
ds2000 has given you the dsjob command to issue a RESET, and then a NORMAL run, which would take care of steps 2 and 3 above.chulett wrote: 1. Checks the status of the job to be run
2. If the job is in an Aborted state, issue the RESET dsjob command
3. Then issue the actual dsjob NORMAL command to run the job
Regarding step 1, use the following BASIC code to get the job status-
Code: Select all
DSGetJobInfo(DSAttachJob(JobName, DSJ.ERRNONE), DSJ.JOBSTATUS)
gateleys
Thank you Friends,
I got your idea regarding RESET ing a job and then run.
But I am still facing problems while running dsjob with parameters.
I am running this command :
D:\Ascential\DataStage\Engine\bin\dsjob -run -param ApplicationCode=Invocation ID -wait -jobstatus PPInterface Create_Files.Invocation ID
We are trying to integrate TIVOLI Workload Schedular(TWS) with Datastage.We are planning to execute all the Datastage Jobs from TWS.
(1) When we run the above command directly from TWS it gives problems.It Does not start the Job.
(2) When I run this command in the Command Prompt of the Datastage server , this worked fine
(3) And Also we tried executing a batch file containing this command from TWS.It also worked fine.
Now my question is why we are not able to run the command directly from TWS.
Please Suggest
Thanks
Arun
I got your idea regarding RESET ing a job and then run.
But I am still facing problems while running dsjob with parameters.
I am running this command :
D:\Ascential\DataStage\Engine\bin\dsjob -run -param ApplicationCode=Invocation ID -wait -jobstatus PPInterface Create_Files.Invocation ID
We are trying to integrate TIVOLI Workload Schedular(TWS) with Datastage.We are planning to execute all the Datastage Jobs from TWS.
(1) When we run the above command directly from TWS it gives problems.It Does not start the Job.
(2) When I run this command in the Command Prompt of the Datastage server , this worked fine
(3) And Also we tried executing a batch file containing this command from TWS.It also worked fine.
Now my question is why we are not able to run the command directly from TWS.
Please Suggest
Thanks
Arun
Arun Verma
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Craig has almost certainly identified the problem, without saying so. I believe that the TWS process has not executed the DataStage dsenv script and therefore does not have the appropriate environment variables set.
Once you post the actual error messages we will be on firmer ground with our diagnoses.
Once you post the actual error messages we will be on firmer ground with our diagnoses.
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.
Easiest way out... schedule your job the normal way via the DataStage gui's. Then look at what DataStage puts into the scheduler, if you put that in TWS it will work.
On Unix it works the same with crontab. If you even want to go a step further you can make sure that DataStage first sees your own "crontab" in its path and then you can plugin your own scheduler more directly into DataStage. Little experience with DataStage on Windows so I don't know whether it would work there as well.
On Unix it works the same with crontab. If you even want to go a step further you can make sure that DataStage first sees your own "crontab" in its path and then you can plugin your own scheduler more directly into DataStage. Little experience with DataStage on Windows so I don't know whether it would work there as well.
In theory there's no difference between theory and practice. In practice there is.
Hello Friends,
I am closing this post as I have got the solution to my problem.
Thanks a lot for all your support.
And also one learning i want to share.
If we want to use multiple parameters in dsjob comand we have to use it like this :
dsjob -run -param P1=V1 -param P2=V2 -wait -Jobstatus Project_Name JobID
I am closing this post as I have got the solution to my problem.
Thanks a lot for all your support.
And also one learning i want to share.
If we want to use multiple parameters in dsjob comand we have to use it like this :
dsjob -run -param P1=V1 -param P2=V2 -wait -Jobstatus Project_Name JobID
Arun Verma