This task shows you how to use Rational® Application Developer to create a simple batch
application.
About this task
This task describes the steps that are needed to create a simple modern batch application with
Rational Application Developer. To fully develop a batch application
to suit your requirements see Developing applications.
You can also use IBM® CICS SDK for Java™ to
create the same application. For more information, see Developing the sample application with IBM CICS SDK for Java.
In this sample, we will use the wizard to create the following artifacts:
- A batch project called MyBatchProject, that contains all the components for the batch
application
- A Java class for a single job step called
MyBatchJobStep.
- An xJCL file for a batch application called MyBatchApplication
- A checkpoint algorithm that will take a checkpoint after every 50 records are read.
- A results algorithm that controls the actions to be taken based on the return code of the job
step.
- Input and output streams
Procedure
-
FTP the following JARs in binary mode:
- From the feature pack install directory:
- From the CICS installation directory:
- com.ibm.cics.server.jar
- com.ibm.record.jar
-
If not already running, start Rational Application Developer.
Click .
-
From the wizard menu, expand Modern Batch and select Batch
Project. Click Next.
-
Enter a name for the project and click Finish.
The wizard creates the projects for your batch application.
-
Configure the build path for the project, by right-clicking the project . Add the JARs you imported in step 1
-
In the Enterprise Explorer, right-click the batch project folder and click .
The Batch job wizard opens.
-
Select the Batch project name and the Job Type.
Enter the name of the new batch job. The Controller Qualified Name and the
xJCL (Job) Folder location are loaded with default values, and can be
ignored.
-
Click Next.
The wizard opens the
Batch Step Creation page:
For more information, see Batch job steps
-
In this example, we will create our own pattern so set Select pattern to
Custom.
-
Click Create class
-
In the Name field, choose a name for your package.
-
Click Finish.
-
In the Optional Properties section, click Add
and enter debug for the name and true for the
value.
Add is only active when a valid implementation class is specified.
-
Create a Checkpoint Algorithm.
This example checkpoints after every 50 records have been processed.
-
Click Add next to Checkpoint Algorithm.
The Checkpoint Algorithm wizard opens.
-
Enter a name. We have used checkpoint in this example.
-
In the Select Pattern field, select Record
Based.
-
In the Required Properties section, click
Add.
-
Enter the following name-value pairs:
recordcount 50
TransactionTimeOut 20
-
Click Finish to return to the Batch Job Step page of the wizard
-
Create a Result Algorithm.
This example uses the Job Sum pattern to return the highest return code of all of the job
steps in the job.
-
Click Add next to Result Algorithm.
The Result Algorithm wizard opens.
-
Enter a name. We have used jobsum in this example.
-
In the Select Pattern field, select Job
Sum.
The Job Sum pattern does not have any required properties.
-
Click Finish to return to the Batch Job Step page
of the wizard.
-
Click Next.
-
Create a Step Input Stream.
This example uses the VsamKsdsReaderImpl interface.
-
Enter a name for the input stream. This example uses inputStream.
-
Set Select pattern to Custom Stream.
-
Set the Implementation class. Click browse, search for and select
VsamKsdsReader located in the com.ibm.cics.batch.bds.impl
package.
-
In the Required properties section, click Add and
enter the following name-value pairs:
CICSFILE BATCHIN
KEYLENGTH 4
START F0F0F0F0
-
Click Next.
-
Create a Step Output Stream.
This example uses the VsamKsdsRecordUpdaterImpl interface.
-
Enter a name for the output stream. This example uses
outputStream.
-
Set Select pattern to Custom Stream.
-
Set the Implementation class to
com.ibm.cics.batch.bds.impl.VsamKsdsRecordUpdaterImpl.
-
In the Required properties section, click Add and
enter the following name-value pair:
-
Click Finish.
-
Open the xJCL editor. Change the default application name to the name of your new batch job,
MyBatchJob.
Note: The default application name must be the same as the batch job name.
What to do next
You can use the xJCL editor to modify the elements of the batch job, for example, to change the
data streams used.
You can now edit the batch job Java file, for example, to
call an existing COBOL batch job.
Note: You can check the return code of the job step for one of the values in the class
BatchConstants. See
Class BatchConstants.