How to abort jobs that finish with warnings

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

How to abort jobs that finish with warnings

Post by Marley777 »

Hi, thanks for reading and any help you can offer. Trying to set up a sequencer so that it restarts when an error or warning is encountered. Each activity in the sequencer has two triggers one for 'ok' and one for 'otherwise'. The 'otherwise' trigger sends processing to a e-mail activity then a terminate activity. When a warning is encounterd in a job and the jobs is corrected...the restart doesn't work. The sequencer doesn't pick up where it left off and continues to abort...skips everything and goes straght to abort. We are adding check points, and automatically handle activities that fail. Do I need to abort jobs that finished with warnings in order for the restartablility to work correctly? If the answer is yes...how do I abort jobs that finish with a warning?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, jobs must abort for the checkpoint restart to work.

Create an after-job routine that checks JOBINTERIMSTATUS which shows what the final status will be at that point. If it says that it will be finishing with warnings, abort the job by calling DSLogFatal() with an appropriate message.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post by Marley777 »

Hi chulett, I must admit creating routines is not my strength...work in a shop that doesn't create a whole lot of routines. Do you have a routine that does what you desribe?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Any I'd have right now would be Informatica related. :wink:

Perhaps an exact search of the forums for JOBINTERIMSTATUS would turn up something useful?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post by Marley777 »

Hi thanks for reading and your help. In my after job routine I check the job status JOBINTERIMSTATUS then call DSLogFatal. I 'm having issues trying to call DSLogFatal() ....nothing happens in my routine when the job finished with warning. Should I pass arguments when calling DSLogFatal...anyone have an example of a call to DSLogFatal? I searched the forum and don't see anywhere where arguments are passed, wanted to make sure.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

These are all in the "online" help. From the Designer go to Help, then Index and then type DSGet and it will take you right there. It only takes one argument, the actual fatal (red) message to put in the log.

If nothing is happening then it's not being called. Post your code.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post by Marley777 »

Hi, I added logic to an existing after job sub routine. The new logic should aborts jobs that finish with warnings. Below is the code I have added.

If ObjectStatus = "Finished with warnings" Then
Call DSLogFatal("Warning in":JobName)
return
End

When there are no warnings the job runs fine...when there are warning the job aborts; which is what I want it to do. I assume I'm doing it right, but was expecting to see more in the log because I pass "warning in" JobName to DSLogFatal??? Is there a reliable way to make sure the job is aborting becaue I'm asking it to abort rather than aborting for some other unknown reason??

Here is the abort message from the log
Attempting to Cleanup after ABORT raised in job srcJob_testing1..AfterJob
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post by Marley777 »

My gut feeling was correct...I should have seen something different in the log. In teh code copy/pasted in my previous post....I was only passing one argument to DSLogFatal. I'm passing two now and see the following in the log.

"Warning in testjob"

which is what I expected to see. Everything is working. Thanks for your help chulett :)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

D'oh! Forgot that it takes two arguments but a quick trip to the documentation shows them:

DSLogFatal: Logs a fatal error message in a job's log file and terminates the job.

Syntax

Call DSLogFatal (Message, CallingProgName)

Message (input) is the warning message you want to log. Message is automatically prefixed with the name
of the current stage and the calling before/after subroutine.

CallingProgName (input) is the name of the before/after subroutine that calls the DSLogFatal subroutine.
-craig

"You can never have too many knives" -- Logan Nine Fingers
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

I know this is an old topic but I have two questions.

1) When you folks talk about after-job routine, are you talking about the After-job subroutine options (such as DSJobReport, DSsendMail etc.) in the Job Properties?

2) If answers to #1 is yes, server BASIC routines can be executed through After-job subroutines, right?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

1) Yes, though not those ones. Routines directly crafted as type "before/after subroutine".
2) Yes
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply