Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop batch applications > Develop batch applications > Develop a simple transactional batch application > The batch programming model


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:

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> 

The batch programming model
Batch job steps
Batch controller bean

+

Search Tips   |   Advanced Search