Understanding the xJCL

This section gives an overview of the various elements that make up an xJCL batch job. XML is provided for each section of the batch job followed by a description of the elements and their properties.

xJCL is an XML based Job Control Language, and is used in a similar manner to MVS JCL. xJCL describes the steps of a Java batch job and the input and output data for each step. xJCL has elements for expressing all of the information needed to define a batch job. The xJCL definition of a job is not part of the batch application, but is constructed separately and submitted to the job scheduler to run. The job scheduler uses information in the xJCL to determine where and when to run the job.

For a fully worked example see Creating xJCL for the sample batch job.

Job

This is the parent element which contains all the information needed to run the application. All the following elements must exist within the "job" tag.
<job xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://core.wcg.etools.ibm.com/xsd/xJCL.xsd" name="[IDENTIFIER]"> 
</job>
  • Change [IDENTIFIER] to the name of your application as specified in the batch-containerconfig.xml.

Job scheduler information

This element passes information about the application to the Job Scheduler in WAS.
<job-type>Batch</job-type>

<step-scheduling-criteria>

 <scheduling-mode>sequential</scheduling-mode>

</step-scheduling-criteria> 
  • Batch and sequential are the only options available and both must be specified.

Checkpoint algorithm

This element is used to declare a checkpoint algorithm that can be used within a job step to determine how often the job takes a checkpoint.
<checkpoint-algorithm name="[IDENTIFIER]">

 <classname>[QUALIFIEDCLASSNAME]</classname>

</checkpoint-algorithm> 
  • Change [IDENTIFIER] to a logical name for your checkpoint algorithm.
  • Change [QUALIFIEDCLASSNAME] to the full name of the checkpoint algorithm implementing class.

Results algorithms

This element is used to declare a results algorithm which can be used within a job step to control how return codes are used. If no algorithm is specified, jobs return RC=0 by default.
<results-algorithms>

 <results-algorithm name="[IDENTIFIER]">

  <classname>[QUALIFIEDCLASSNAME]</classname>

 </results-algorithm>

</results-algorithms> 
  • Change [IDENTIFIER] to a logical name for your results algorithm
  • Change [QUALIFIEDCLASSNAME] to the full name of the implementing class for the result algorithm. You can use the supplied jobsum algorithm or create a custom algorithm. Properties are passed with a <props> section within the <results-algorithm> section.
Note: The supplied results algorithm, jobsum, requires no additional properties.

Job step

This element declares a Job Step, pointing to the Java class that contains the business logic, and referencing any checkpoint or results algorithms to be used in that step.
<job-step name="[JOBSTEPNAME]">

 <classname>[QUALIFIEDCLASSNAME]</classname>

 <checkpoint-algorithm-ref name="[IDENTIFIER]"/>

 <results-ref name="[IDENTIFIER]"/>

</job-step> 
  • Change [JOBSTEPNAME] to a logical name for your job step.
  • Change [QUALIFIEDCLASSNAME] to the full name of the Java class representing the business logic of the job step, implementing the BatchJobStepInterface.
  • Change [IDENTIFIER] for checkpoint-algorithm-ref name, to the name specified in the Checkpoint Algorithm section.
  • Change [IDENTIFIER] for results-ref name, to the name specified in a Results Algorithm section.

Batch data streams

Note: This section must reside within a job step section.
This element can be used to declare Batch Data Streams (BDS) as input or output streams for a job step. The logical-name is referenced within the job step's Java class as either an input or output stream.
<batch-data-streams>

 <bds>

  <logical-name>[IDENTIFIER]</logical-name>

  <impl-class>[QUALIFIEDCLASSNAME]</impl-class>

 </bds>

</batch-data-streams> 
  • Change [IDENTIFIER] to the name of the stream as specified in the application's implementing class. The name must be unique.
  • Change [QUALIFIEDCLASSNAME] to the full name of a supplied or custom class name for the data stream.

Properties

This element can be added within any of the following elements: Job Step, Batch Data Stream, Checkpoint Algorithm or Result Algorithm. It consists of a name-value pair that is used to pass required or optional information to the element where it is defined.
<props>

 <prop name="[NAME]" value="[VALUE]"/>

</props> 
  • Add any optional or required properties in the <props> section, changing [NAME] and [VALUE] as appropriate

Example

You can copy this example and paste it into your editor, then make the changes described in the preceding text.

<?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="[NAMEOFAPPLICATION]">
  <job-type>Batch</job-type>
  <step-scheduling-criteria>
    <scheduling-mode>sequential</scheduling-mode>
  </step-scheduling-criteria>
  <checkpoint-algorithm name="[IDENTIFIER]">
    <classname>[QUALIFIEDCLASSNAME]</classname>
    <props>
      <prop name="[NAME]" value="[VALUE]"/>
    </props>
  </checkpoint-algorithm>
  <results-algorithms>
    <results-algorithm name="[IDENTIFIER]">
      <classname>[QUALIFIEDCLASSNAME]</classname>
    </results-algorithm>
  </results-algorithms>
  <job-step name="[JOBSTEPNAME]">
    <classname>[QUALIFIEDCLASSNAME]</classname>
    <checkpoint-algorithm-ref name="[IDENTIFIER]"/>
    <batch-data-streams>
      <bds>
        <logical-name>[IDENTIFIER]</logical-name>
        <impl-class>[QUALIFIEDCLASSNAME]</impl-class>
        <props>
          <prop name="[NAME]" value="[VALUE]"/>
        </props>
      </bds>
      <bds>
        <logical-name>[IDENTIFIER]</logical-name>
        <impl-class>[QUALIFIEDCLASSNAME]</impl-class>
        <props>
          <prop name="[NAME]" value="[VALUE]"/>
        </props>
      </bds>
    </batch-data-streams>
    <props>
      <prop name="[NAME]" value="[VALUE]"/>
    </props>
    <results-ref name="[IDENTIFIER]"/>
  </job-step>
</job>