Results algorithms

Results algorithms are an optional feature of the batch programming model.

A results algorithm allows for two types of actions to occur at the end of a batch step:

Results algorithms are applied to a batch job through XML Job Control Language (xJCL). These algorithms are declared in xJCL and then applied to batch steps.

At the end of a batch step, the grid endpoints check the xJCL of the batch job to determine which results algorithm to invoke. For each results algorithm specified, the grid endpoints pass to the algorithm the return code of the batch step, which is the integer returned by the destroyJobStep method of the step, and the current return code of the batch job in the grid endpoints database. The results algorithm can then act based on the return codes passed in. The algorithm then passes a return code for the batch job back to the grid endpoints, which is persisted to the grid endpoints database as the current return code of the batch job. This return code can be the same as the return code that the grid endpoints passed to the results algorithm initially, or the return code can be different, depending on logic coded into the results algorithm. If a results algorithm is not specified on a batch step, the job return code is that of the results algorithm from the previous step. If no results algorithms are specified, the job return code is zero (0).

A results algorithm system programming interface (SPI) is also provided, which you can use to write your own algorithms and apply them to batch jobs.

The jobsum results algorithm

The jobsum results algorithm returns the highest return code of job steps to the grid endpoints. For example, there are three steps in the job (step1, step2, step3) where the following conditions exist:
  • step1 returned 5
  • step2 returned 8
  • step3 returned 2. The jobsum algorithm ensures that 8 is passed to the grid endpoints as the final return code of the job.
Example of applying a jobsum and custom results algorithm to steps
<job name="PostingSampleEar">

  <results-algorithms>
     <results-algorithm name="jobsum">
        <classname>com.ibm.wsspi.resultsalgorithms.jobsum</classname>
  </results-algorithm>

     <results-algorithm name="custom_algorithm">
           <classname>my_custom_algorithm</classname>
     </results-algorithm>

</results-algorithms> 


<job-step name="Step1">

     <results-ref name="jobsum">
  </job-step>

<job-step name="Step2">

     <results-ref name="custom_algorithm">
  </job-step>

</job>



Related concepts
The batch programming model
Batch job steps
Batch controller bean
Concept topic Concept topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Jan 30, 2014 9:17:32 AM CST
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-iseries&topic=cgrid_xdbatchres
File name: cgrid_xdbatchres.html