Use this information to create the xJCL for a batch job.
About this task
You can use the xJCL template in this task to create your
own xJCL. xJCL for the feature pack sample batch applications is also
provided in the zFS directory <install root>/batchfp/samples/config.
The
following sample illustrates the xJCL to define the components of
a batch job:
- The Checkpoint algorithms section,
where you specify how often to commit the CICS® Units of Work (UOW)
under which batch steps are started.
- The Results algorithm section,
where you specify the actions to take in response to the return code
of each job step.
- The Batch job steps section,
where you specify the class to be run for the job step.
- The Batch Data Streams section,
where you specify the data to use within a job step.
Procedure
- Set the value of name in the job tag to
your batch application name. Set the scheduling mode to sequential and
the job type to Batch.
<job xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://core.wcg.etools.ibm.com/xsd/xJCL.xsd" name="MyBatchJob">
<job-type>Batch</job-type>
<step-scheduling-criteria>
<scheduling-mode>sequential</scheduling-mode>
</step-scheduling-criteria>
- Set the classname to your implementing checkpoint algorithm class. For more information, see Checkpoint algorithms.
<checkpoint-algorithm name="cp">
<classname>com.ibm.wsspi.batch.checkpointalgorithms.recordbased</classname>
<props>
<prop name="recordcount" value="20"/>
<prop name="TransactionTimeOut" value="20"/>
</props>
</checkpoint-algorithm>
- Set the values that you want in recordcount. The example shows a record based checkpoint where a checkpoint
is taken every 20 records.
Note: TransactionTimeOut is
ignored on a checkpoint algorithm.
- In the results-algorithms section, set
the <classname> to your implementing results algorithm. This example uses the provided job sum algorithm, which takes the highest
return code from the steps in the
job.
<results-algorithms>
<results-algorithm name="js">
<classname>com.ibm.wsspi.batch.resultsalgorithms.jobsum</classname>
</results-algorithm>
</results-algorithms>
For
more information, see Results algorithms.
- In the job-step section, set the <classname> to
your implementing job step class, and the checkpoint algorithm to
the name you gave to the checkpoint-algorithm in
step 2.
<job-step name="MyBatchJobStep">
<classname>com.ibm.cics.batch.test.TestBatchJob</classname>
<checkpoint-algorithm-ref name="cp"/>
- In the batch-data-streams section, add
the batch data streams needed for your batch application. You
must provide a logical name that identifies this BDS in your job step
class. For more information, see Batch Data Streams.
- Set the <props> section of each batch
data stream to include any required and optional properties for that
stream:
For example, the input batch data stream provided
with the feature pack as com.ibm.cics.batch.bds.impl.VsamKsdsReaderImpl requires
the following properties:
Required properties are:
- CICSFILE - the VSAM file to be used as defined
in the CICS resource.
- START - the key of the record where reading
is to start, in a hexadecimal format. For example, F0F0F1F0
= 10.
- KEYLENGTH - the length of the key that is
defined in the VSAM file.
The output batch data stream provided with the feature
pack as com.ibm.cics.batch.bds.impl.VsamKsdsRecordUpdaterImpl requires
the following property:.
CICSFILE the
VSAM file to be used as defined in the CICS resource.
<batch-data-streams>
<bds>
<logical-name>inputStream</logical-name>
<impl-class>com.ibm.cics.batch.bds.impl.VsamKsdsReaderImpl</impl-class>
<props>
<prop name="CICSFILE" value="BATCHIN"/>
<prop name="START" value="F0F0F0F0"/>
<prop name="KEYLENGTH" value="4"/>
</props>
</bds>
<bds>
<logical-name>outputStream</logical-name>
<impl-class>com.ibm.cics.batch.bds.impl.VsamKsdsRecordUpdaterImpl</impl-class>
<props>
<prop name="CICSFILE" value="BATCHOUT"/>
</props>
</bds>
</batch-data-streams>
- The <props> section lists any properties
that must be passed to the job. The example specifies the debug property,
so that any debug logs in the job step class are written to the log
file.
<props>
<prop name="debug" value="true"/>
</props>
- Set the results-ref to the name of the results
algorithm defined in step 4.
<results-ref name="js"/>
Example
<?xml version="1.0" encoding="ASCII"?>
<job xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://core.wcg.etools.ibm.com/xsd/xJCL.xsd" name="MyBatchJob">
<job-type>Batch</job-type>
<step-scheduling-criteria>
<scheduling-mode>sequential</scheduling-mode>
</step-scheduling-criteria>
<checkpoint-algorithm name="cp">
<classname>com.ibm.wsspi.batch.checkpointalgorithms.recordbased</classname>
<props>
<prop name="recordcount" value="20"/>
<prop name="TransactionTimeOut" value="20"/>
</props>
</checkpoint-algorithm>
<results-algorithms>
<results-algorithm name="js">
<classname>com.ibm.wsspi.batch.resultsalgorithms.jobsum</classname>
</results-algorithm>
</results-algorithms>
<job-step name="MyBatchJobStep">
<classname>com.ibm.cics.batch.test.TestBatchJob</classname>
<checkpoint-algorithm-ref name="cp"/>
<batch-data-streams>
<bds>
<logical-name>inputStream</logical-name>
<impl-class>com.ibm.cics.batch.bds.impl.VsamKsdsReaderImpl</impl-class>
<props>
<prop name="CICSFILE" value="BATCHIN"/>
<prop name="START" value="F0F0F0F0"/>
<prop name="KEYLENGTH" value="4"/>
</props>
</bds>
<bds>
<logical-name>outputStream</logical-name>
<impl-class>com.ibm.cics.batch.bds.impl.VsamKsdsRecordUpdaterImpl</impl-class>
<props>
<prop name="CICSFILE" value="BATCHOUT"/>
</props>
</bds>
</batch-data-streams>
<props>
<prop name="debug" value="true"/>
</props>
<results-ref name="js"/>
</job-step>
</job>
What to do next
You can now implement the methods in your job step class
to call your business logic. You can then deploy your application.