How to abort a job in Afterjob sub routine
Moderators: chulett, rschirm, roy
How to abort a job in Afterjob sub routine
Hi All i have a requirement in which i have to abort the job
if the reject link count is greater than 0 i.e i have to abort the job if the job has some reject records.
this i have to take care in the after job sub routine ....for this i am using DSStopJob as..
if intNoRecRejected > 0 Then
iErrorCode=DSStopJob(DSJ.ME)
Call DSLogInfo("Stop error Code ":iErrorCode,DSJ.ME)
END
but it is returning the error code as -1.
is there any other way to abort the job for the above mentioned condition?
thanks,
Naru
if the reject link count is greater than 0 i.e i have to abort the job if the job has some reject records.
this i have to take care in the after job sub routine ....for this i am using DSStopJob as..
if intNoRecRejected > 0 Then
iErrorCode=DSStopJob(DSJ.ME)
Call DSLogInfo("Stop error Code ":iErrorCode,DSJ.ME)
END
but it is returning the error code as -1.
is there any other way to abort the job for the above mentioned condition?
thanks,
Naru
Re: How to abort a job in Afterjob sub routine
The question is where are you catching the rejections ? If from a transformer, the transformer has this option in the 'constraints'. Check it out.nvuradi wrote:...
is there any other way to abort the job for the above mentioned condition?
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
I'm not on a system where I have DS installed, but I seem to recall that DSStopJob() function can only be used from the controlling job. If you need to abort a job from the job itself you need to call DSLogFatal().
Better is to set the number of links output down a link to 0 so that the job aborts in the correct place and not after completing all processing.
Better is to set the number of links output down a link to 0 so that the job aborts in the correct place and not after completing all processing.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
one more thing i dont have a transformer in my Job...nvuradi wrote:hi i have to abort the job in Afterjob sub routine .....kumar_s wrote:Or Call 'Abort' in the routine. Or use 'Abort after n row' option for the reject link. ...
can this be done??....
how can i use this ???..Or use 'Abort after n row' option for the reject link. ...
If you have no transform stage and don't want to put one in, then you should use the reject link as your abort trigger as mentioned twice above.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
You have a reject link somewhere in your job as you specified in your original post. From which stage is this link coming from? Also, look at "Linking" in the DataStage Designer Guide starting at page 4-14.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
I see - I saw that this was posted in the Server forum and that changes things. Put your reject link to a transform stage, then onto to whatever file output stage (or a PEEK stage) you want. In the Transform output details tell the job to abort after 1 rows down that link.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
1. Why? All rows that have been sent to the database have been committed by the time an after job subroutine is being executed. Aborting a job in an after job subroutine makes as much sense as buying a lottery ticket after the lottery has been drawn.nvuradi wrote:i have to abort the job in Afterjob sub routine .....
can this be done??....
how can i use this ???..
2. Yes it can be done. Make a call to DSLogFatal() within the after job subroutine.
3. Because of my point #1, this question is moot.
Last edited by ray.wurlod on Tue Feb 06, 2007 1:38 am, edited 1 time in total.
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Your requirement to abort the job is unnecessary. A far better design would be to check that the row (or key value) in question does not already exit in the target table before attempting to insert it. Any row that does already exist can be captured in a different ("reject"?) stream and processed accordingly. There is still no need to abort the job. Maintain control at all time.
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.