DSStopJob(DSJ.ME) is failing in JOB CONTROL

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
Rubu
Premium Member
Premium Member
Posts: 82
Joined: Sun Feb 27, 2005 9:09 pm
Location: Bangalore

DSStopJob(DSJ.ME) is failing in JOB CONTROL

Post by Rubu »

Hi

I put the following script inside the JOB control of a job. I want it to stop when the parameter RE_PLAY='N'.

IF RE_PLAY="N"
THEN
ErrCode = DSStopJob(DSJ.ME)
IF ErrCode=0
THEN
Call DSLogInfo("Job stopped because input file empty", "Job control")
END
ELSE
Call DSLogWarn("Error Stopping", "Job control")
END
END


But the DSDtopJob is not executiong perfectly, and the value of ErrCode=DSJE.BADHANDLE. For other functions DSJ.ME is working OK ... Please help... why datastage is showing such weird behaviour?

Regards
rubu
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The DSStopJob function is designed to stop jobs that are controlled by the current one, not for the job itself. If you wish to stop your own job from within the Job Control you could issue a call to DSLogFatal('Your message','ProgramName'). This call does not return and set the status of the job to ABORTed. If you wish to finish the job without any errors then I am not sure what to do, since issuing an explicit STOP command leaves the director thinking that the job is still running. I would then recommend to put this logic one level higher, i.e. writing a sequence or job which then calls the actual processing job depending on the outcome of a condition.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Just use DSLogFatal to abort a job by writing a RED message to the job log. That will leave the job in an unusable state, just the same as if another job issued the STOP call.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply