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. Multiple results algorithms can be applied to a batch step.
At the end of a batch step, the long-running execution environment check the xJCL of the batch job to determine which results algorithms to invoke. For each results algorithm specified, the long-running execution environment pass to the algorithm the return code of the batch step. The integer returned by the destroyJobStep method of the step, and the current return code of the batch job in the long-running execution environment database. The results algorithm can then take any action based on the return codes passed in. The algorithm then passes a return code for the batch job back to the long-running execution environment, which is persisted to the long-running execution environment database as the current return code of the batch job. This return code can be the same as the return code that the long-running execution environment passed to the results algorithm initially, or the return code can be different, depending on logic coded into the results algorithm.
A results algorithm Serial Peripheral Interface (SPI) is also provided, which you can use to write your own algorithms and apply them to batch jobs. Review the API for this service provider interface (SPI).
The source code of the jobsum algorithm is provided in the WebSphere Extended Deployment Information Center.
Example of applying a jobsum results algorithm to steps
<job name="PostingSampleEar"> <results-algorithms> <results-algorithm name="jobsum"> <classname>com.ibm.wsspi.resultsalgorithms.jobsum</classname> </results-algorithm> </results-algorithms> <job-step name="Step1"> <results-ref name="jobsum"> </job-step> <job-step name="Step2"> <results-ref name="jobsum"> </job-step>
Example of applying multiple algorithms to steps of a job
</job> <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-algoriths> <job-step name="Step1"> <results-ref name="jobsum"> </job-step> <job-step name="Step2"> <results-ref name="custom_algorithm"> <results-ref name="jobsum"> </job-step> </job>