after job subroutine to reset a failed independent job

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
dsrules
Premium Member
Premium Member
Posts: 76
Joined: Sun Nov 28, 2004 8:56 pm

after job subroutine to reset a failed independent job

Post by dsrules »

Hi,

Need help in resolving after job subroutine to reset a failed individual job. Requirement is not to use sequencers.
Calling this routine in after job subroutine. But job aborts and doesn't reset itself. In the director state of the job is still running.

$INCLUDE DSINCLUDE DSJ_XFUNCS.H
$INCLUDE DSINCLUDE JOBCONTROL.H

JobHandle = DSAttachJob(jobname, DSJ.ERRNONE)

if JobHandle = 0 Then
Call DSLogFatal('Job ' : jobname :' is not found', 'jobReset')
Ans = 1
End Else
jobstatus = DSGetJobInfo(JobHandle, 1)
if jobstatus <> DSJS.RUNNING Then
Call DSLogInfo('Job ' : jobname :' is not running', 'jobReset')
if jobstatus = DSJS.RUNFAILED Then
Call DSLogInfo('Job ' : jobname :' is aborted. Try to reset it', 'jobReset')
RunErr = DSRunJob(JobHandle, DSJ.RUNRESET)
if RunErr = 0 Then
Call DSLogInfo('Job ' : jobname :' is reset', 'jobReset')
End
End
End
Ans = 0
End

Appreciate your help.
______________________________________
"Everytime I close the door on reality, it comes in through the windows." - Jennifer Yane
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

A job can't reset itself "after job" as it's still running at that point. Better to reset before the next run rather than immediately after the abort.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: after job subroutine to reset a failed independent job

Post by ray.wurlod »

dsrules wrote:Requirement is not to use sequencers.
Resist stupid requirements.

In any case, a sequencer would not help. A sequence may, however.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

An aborted job can't reset itself either, because it's aborted (no longer executing). And, if it's not aborted, why do you want to reset it?

If you're not going to use a sequence then you need a separate job, perhaps one that contains only job control code.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsrules
Premium Member
Premium Member
Posts: 76
Joined: Sun Nov 28, 2004 8:56 pm

Post by dsrules »

I am calling this routine in before job subroutine and passing input value as jobname. But the job state still shows running in the director log.

Please need help or share code to perform the task.

Ray,

Not a premium member so couldn't see your whole message.

Appreciate your help guys.
______________________________________
"Everytime I close the door on reality, it comes in through the windows." - Jennifer Yane
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What task? A job cannot reset itself, period, before or after. And if it's Aborted, how do you run it to get to the 'before' part without manually resetting it first?

Can you clearly state exactly what the requirements are you're trying to implement? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
dsrules
Premium Member
Premium Member
Posts: 76
Joined: Sun Nov 28, 2004 8:56 pm

Post by dsrules »

There are some 15-20 SAP BW Pack Load jobs which are triggered by SAP developers manually. For these jobs, if aborted, the subroutine should reset the jobs for the next run instead of SAP developers doing it.

For this requirement, need to write a subroutine and call it in before/after job subroutine of the job properties.

Hope the requirement is clear.

Appreciate your help.
______________________________________
"Everytime I close the door on reality, it comes in through the windows." - Jennifer Yane
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Clear but fatally flawed. :?

You need to understand that 'before job' does not mean 'before the job starts' just like 'after job' does not mean 'after the job finishes'. In both cases, the job is actually running when those sections trigger but one is before the objects on the canvas are started and the other is after the objects on the canvas finish.

Since the job is either already running or still running, a before or after job subroutine cannot be used to reset the job it is triggered by. Period. In order to satisfy the requirements, you should build matching Sequence jobs that just call those SAP BW Load jobs via a Job Activity stage set to 'Reset if required then Run' and have your developers manually trigger the Sequence job rather than the load job directly. Problem solved.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dsrules
Premium Member
Premium Member
Posts: 76
Joined: Sun Nov 28, 2004 8:56 pm

Post by dsrules »

Resolved.
______________________________________
"Everytime I close the door on reality, it comes in through the windows." - Jennifer Yane
ROCKETSINGH
Participant
Posts: 1
Joined: Mon Feb 22, 2010 5:22 pm
Location: why

Post by ROCKETSINGH »

dsrules wrote:Resolved.
how did you resolve the problem?
ROCKETSINGH
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The resolution is (IMHO) spelled out pretty clearly in the answers here. If you need some clarification, let us know what is unclear. If you have an actual problem to solve, please start a new post and give us all the particulars of your issue.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply