DsStopFunction in the after job routine.

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Madhu1981
Participant
Posts: 69
Joined: Wed Feb 22, 2006 7:49 am

DsStopFunction in the after job routine.

Post by Madhu1981 »

Hi All,

I want to stop the current runninhg job through after job routine by using DSStopJob function.
Shall we use DSStopJob function to stop the current function.

I have written a code for this, but the job is not stopping. The status of the job is Finished with warnings.

Kindly look at my code.

$INCLUDE DSINCLUDE JOBCONTROL.H

iReadRecCount = DSGetLinkInfo(DSJ.ME,"Transformer_3","DSLink2",DSJ.LINKROWCOUNT)
call DSlogInfo(iReadRecCount, "jobControl") /* Incoming records are more than 0 in my job*\

If iReadRecCount > 0
Then
call DSStopJob(DSJ.ME)
End

ErrorCode = 0 ;* set this to non-zero to stop the stage/job


Please help me.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The DSStopJob() call is issued from a parent process and will not work for the job itself. If you are in the After job routine there is no more processing to do - but you can terminate the job with a fatal error using DSLogFatal().
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This is a before/after subroutine. It is executed either before any rows have been processed (in which case the link row count must be zero), or after all rows have been processed. Its position within the processing stream ensures that it will not stop the job.

I'm not sure why you want to stop the job during its run.

If you want to stop the job because a row is processed on a reject link, all you need to do is set the row limit for that reject link to 1.

Remember, also, that DSRunJob and DSStopJob are asynchronous calls, which means that a request is issued (a signal sent), which is processed when the executing process gets around to it.

If you really want to stop the job based on a row count (and in a routine) then code it as a custom function, which can be executed for every single row processed. Of course, if it is to issue a stop request as soon as there is any row, then all that is needed is the call to stop the job; none of the conditional code is relevant.

Finally, you have specified parallel job; DSStopJob is a DataStage BASIC routine, so is only relevant for server routines. You will need to find the equivalent C++ routine for use in your custom function.
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