Page 1 of 1

Tivoli Schedule

Posted: Fri Jun 08, 2007 9:38 am
by shyamrai
When I am scheduling a job through Tivoli, I am getting an ABEND status in TWS while the datastage job is running successfully.

Then I found out that Tivoli will give a success status only when the job status = 0. But whenever a job in datastage runs successfully, it gives a job status = 1. Can anyone help me out what changes can I make in DataStage and where I can make those changes.

To run the DataStage, I have given the dsjob run command in a batch file which starts the datastage job.

Posted: Fri Jun 08, 2007 4:11 pm
by ray.wurlod
Wrap your dsjob command in a script which catches the exit status and converts 1 (finished OK) and 2 (finished with warning) to 0 and anything else to 1. Or change the rules engine in the Tivoli scheduler so that an exit status of 1 or 2 is "good" for dsjob.

Posted: Fri Jun 08, 2007 4:25 pm
by chulett
You must be using -jobstatus with your dsjob command, that's what tells it you want an exit code of 1 for OK, 2 for Warnings, etc. You could use -wait instead in the dsjob call for more traditional exit code handling.

Simplest answer is to tell Tivoli what is a good exit status and what is a bad one. We've done that for Control-M and it's trivial - it's just not the default behaviour.

Posted: Mon Jun 11, 2007 8:45 am
by shyamrai
The Tivoli job shcedule is used in a lot of other applications. So, do you think status can be applied only to DataStage.

I have used an if command in the batch file through which I schedule it in Tivoli, but I got the below result after the job
Resullt:
Status code=1
=0 was unexpected at this time

Code in batch file
//
echo off

dsjob -run -jobstatus DTR-Reliability MasterSAPPickList

If %jobstatus=1 then %jobstatus=0

else

exit
//


[quote="ray.wurlod"]Wrap your dsjob command in a script which catches the exit status and converts 1 (finished OK) and 2 (finished with warning) to 0 and anything else to 1. Or change the rules engine in the Tivoli scheduler so that an exit status of 1 or 2 is "good" for dsjob.[/quote]

Posted: Mon Jun 11, 2007 9:01 am
by chulett
shyamrai wrote:The Tivoli job shcedule is used in a lot of other applications. So, do you think status can be applied only to DataStage.
Certainly, "they" should be able to do it on a case-by-case basis.

Posted: Mon Jun 11, 2007 9:22 am
by shyamrai
I have contacted the tivoli scheduling team and they have said that it will not be possible for them to set up the status on a case-by-case basis.

Do you think I should be adding any error handling syntax in the code which I have written earlier so that it would change the status at the end of the job.


[quote="chulett"][quote="shyamrai"]The Tivoli job shcedule is used in a lot of other applications. So, do you think status can be applied only to DataStage.[/quote]
Certainly, "they" should be able to do it on a case-by-case basis.[/quote]

Posted: Mon Jun 11, 2007 10:02 am
by shawn_ramsey
I would take Ray's advice and wrap the call to dsjob in a shell script and have the shell script translate the exit code.

Posted: Mon Jun 11, 2007 10:12 am
by shyamrai
We are using the batch files and not the shell scripts to call the DataStage Jobs.

Posted: Mon Jun 11, 2007 10:22 am
by chulett
Batch files, shell scripts - same thing.
I have contacted the tivoli scheduling team and they have said that it will not be possible for them to set up the status on a case-by-case basis.
I find that very hard to believe. Sometimes that boils down to the fact they either don't know how to do it or simply don't want to do it. I know for a fact that it is trivial in Control-M but (unfortunately) can't speak to the specifics of how that would be done in Tivoli.

Posted: Mon Jun 11, 2007 3:16 pm
by shyamrai
I have given the following code and this seems to work fine while scheduling through TWS

@echo OFF

dsjob -run -jobstatus -Project -Job

echo ERRORLEVEL %ERRORLEVEL%

IF ERRORLEVEL 1 SET ERRORLEVEL=0

IF ERRORLEVEL 2 SET ERRORLEVEL=0