Routine Error Code
Moderators: chulett, rschirm, roy
Routine Error Code
Hi all,
In a server routine i am running a server job.
When the server job does not complete successfully then the routine has to return a non zero routine code.
I am calling this routine in after job sub routine in a server job.
When I start i set the ERROr code =0.
Is the routine code and ERROCode the same?
In a server routine i am running a server job.
When the server job does not complete successfully then the routine has to return a non zero routine code.
I am calling this routine in after job sub routine in a server job.
When I start i set the ERROr code =0.
Is the routine code and ERROCode the same?
Wait... you wrote a routine that runs a job and you run that job in the 'After Job' area of another job? Why would you want to do that? Seems like a Sequence job would be more appropriate to run the two jobs in a serial fashion...
If you pursue this course, then yes - you'll need to detect errors in the job the routine runs and then set the error code to a non-zero value if you want the problem to be noticed.
If you pursue this course, then yes - you'll need to detect errors in the job the routine runs and then set the error code to a non-zero value if you want the problem to be noticed.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
What kind of routine - transform function or before/after subroutine?
Where (and how) are you invoking this routine?
Can you post the source code of the routine, so we can hopefully get a clearer idea of what you are trying to accomplish? Wrap the code in "Code" tags (select the source code, and click the Code button above).
Where (and how) are you invoking this routine?
Can you post the source code of the routine, so we can hopefully get a clearer idea of what you are trying to accomplish? Wrap the code in "Code" tags (select the source code, and click the Code button above).
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.
Sorry it waschulett wrote: Wait... you wrote a routine that runs a job and you run that job in the 'After Job' area of another job? .
I am calling a routine in a job after the job runs .
what the routine does is it takes info from the job i am running and then it runs another job in the routine .
What i am supposed to do is if the job that i am running in the routine fails
then routne has to return a non zero routine code
What will happen is that if the last run of the job you are checking has warnings or error or hasn't run since compilation your current job will abort.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
I'm confused as to your goal. The code does what you ask of it; but we don't know if it makes sense to do so.
Personally I would use a sequence to do this and not make one job abort depending upon some status in another.
Personally I would use a sequence to do this and not make one job abort depending upon some status in another.
<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:
Re: Routine Error Code
That looks like a complete specification.parvathi wrote:Hi all,
In a server routine i am running a server job.
When the server job does not complete successfully then the routine has to return a non zero routine code.
I am calling this routine in after job sub routine in a server job.
When I start i set the ERROr code =0.
Is the routine code and ERROCode the same?
Code: Select all
SUBROUTINE MyRoutine(InputArg, ErrorCode)
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
ErrorCode = 0 ; * set to non-zero value to abort job
hJob = DSAttachJob(....)
JobName = DSGetJobInfo(hJob, DSJ.JOBNAME)
If JobName = DSJE.BADHANDLE
Then
Call DSLogWarn("Failed to attach job.", "MyRoutine")
ErrorCode = DSJE.BADHANDLE
End
Else
SubmitStatus = DSRunJob(hJob, DSJ.RUNNORMAL)
WaitStatus = DSWaitForJob(hJob)
ExitStatus = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
DetachStatus = DSDetachJob(hJob)
ErrorCode = (ExitStatus <> DSJS.RUNOK And ExitStatus <> DSJS.RUNWARN)
End
RETURN
But perhaps that's not what you wanted to do. Maybe all you're seeking is a way to detect, in an after-job subroutine, the exit status of the job in which the after-job subroutine is invoked.
Code: Select all
SUBROUTINE CatchErrorStatus(InputArg, ErrorCode)
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
ErrorCode = 0 ; * set to non-zero value to abort job
* Use interim status; job itself is still "RUNNING".
ExitStatus = DSGetJobInfo(DSJ.ME, DSJ.INTERIMSTATUS)
ErrorCode = (ExitStatus <> DSJS.RUNOK And ExitStatus <> DSJS.RUNWARN)
RETURN
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.