Batch return codes
The batch job return code is retrieved by using the getBatchJobRC EJB interface, the get BatchJobRC web services interface, or the lrcmd getBatchJobRC command option.
The following table lists the system batch job return codes that the batch environment uses. Do not confuse the batch job return code with either the job status constants (see the com.ibm.websphere.longrun.JobStatusConstants API) or the job scheduler constants (see the com.ibm.websphere.longrun.JobSchedulerConstants API). The JobStatusConstants represent the status of the job such as submitted, ended, restartable, canceled, or execution failed.
The job status can be obtained by using the getJobStatus EJB interface, the getJobStatus web services interface, or through the job management console. The JobSchedulerConstants represent operating conditions returned by the job scheduler on requests involving multiple jobs. For example:
int cancelJob( String jobid ))
- Job does not exist
- Job is in an invalid state
- Database exception has occurred.
|0||Job ended normally|
|-4||Job was suspended|
|-8||Job was canceled|
|-10||Job was forcibly canceled (z/OS® only)|
|-12||Job failed and is in restartable state|
|-14||Job failed and is in execution failed state|
- The first option is for the application to produce an exception when an error is encountered.
This results in termination of the job with a batch job return code of -12 and a batch job status of
restartable. The exception can be thrown in any of the methods of the batch API.
- The second option is for the application to return a
BatchConstants.STEP_COMPLETE_EXECUTION_FAILED return code (see the
com.ibm.websphere.batch.BatchConstants API) from the processJobStep method and return an
application-specific error return code from the destroyJobStep method. This results in termination
of the job and a batch job status of
execution failed. The step return code set in the destroyJobStep method is passed to any results algorithm specified on the job step and is used to influence the return code of the job to indicate the specific cause of the failure.
|-1||Internal protocol error|
|-2||Input parameter error|
|-16||Catastrophic failure or execution failed state|
By default, the WSGrid utility reports a WSGrid specific -16 return code if the Java Batch job it submitted ends in execution failed state. The com.ibm.websphere.batch.execution.failed.wsgrid.rc job scheduler custom property changes the default behavior of the WSGrid Java Batch job in execution failed state.