Tivoli Schedule

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
shyamrai
Premium Member
Premium Member
Posts: 18
Joined: Tue May 22, 2007 12:41 pm

Tivoli Schedule

Post 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.
Last edited by shyamrai on Fri Jun 08, 2007 9:40 am, edited 1 time in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
shyamrai
Premium Member
Premium Member
Posts: 18
Joined: Tue May 22, 2007 12:41 pm

Post 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]
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
shyamrai
Premium Member
Premium Member
Posts: 18
Joined: Tue May 22, 2007 12:41 pm

Post 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]
shawn_ramsey
Participant
Posts: 145
Joined: Fri May 02, 2003 9:59 am
Location: Seattle, Washington. USA

Post 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.
Shawn Ramsey

"It is a mistake to think you can solve any major problems just with potatoes."
-- Douglas Adams
shyamrai
Premium Member
Premium Member
Posts: 18
Joined: Tue May 22, 2007 12:41 pm

Post by shyamrai »

We are using the batch files and not the shell scripts to call the DataStage Jobs.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
shyamrai
Premium Member
Premium Member
Posts: 18
Joined: Tue May 22, 2007 12:41 pm

Post 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
Post Reply