Developing the sample application with Rational Application Developer

This task shows you how to use Rational® Application Developer to create a simple batch application.

Before you begin

Follow the steps for installing and configuring the CICS® Modern Batch Feature Pack . See Installing the feature pack and Configuring Modern batch for CICS. A sample is provided in Understanding the xJCL for you to copy into your editor.

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 CICS Explorer® SDK to create the same application. For more information, see Developing the sample application with CICS Explorer SDK.

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

  1. FTP the following JARs in binary mode:
    • From the feature pack install directory:
      • com.ibm.cics.batch.jar
    • From the CICS installation directory:
      • com.ibm.cics.server.jar
      • com.ibm.record.jar
  2. If not already running, start Rational Application Developer. Click File > New.
  3. From the wizard menu, expand Modern Batch and select Batch Project. Click Next.
  4. Enter a name for the project and click Finish.
    This screen capture shows the Batch Project wizard where the project name, location and other properties are entered.
    The wizard creates the projects for your batch application.
    This screen capture shows the folder structure created by the Batch Project wizard.
  5. Configure the build path for the project, by right-clicking the project MyBatchProject > Build path > Configure build path. Add the JARs you imported in step 1
    This screen capture of the Java Build Path dialog box is where you configure the build path.
  6. In the Enterprise Explorer, right-click the batch project folder and click New > Batch Job.
    The Batch job wizard opens.
  7. 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.
    Screen capture of the Batch Job Creation wizard.
  8. Click Next.
    The wizard opens the Batch Step Creation page:
    Screen capture of the Batch Step Creation wizard.

    For more information, see Batch Job steps in the WebSphere Application Server product documentation.

  9. In this example, we will create our own pattern so set Select pattern to Custom.
    For a description of other options, see Batch job steps.
  10. Click Create class
    Screen capture of the Batch Step Creation wizard.
  11. In the Name field, choose a name for your package.
    Screen capture of the Create class dialog.
  12. Click Finish.
  13. 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.
  14. Create a Checkpoint Algorithm.
    This example checkpoints after every 50 records have been processed.
    1. Click Add next to Checkpoint Algorithm.
      The Checkpoint Algorithm wizard opens.
    2. Enter a name. We have used checkpoint in this example.
    3. In the Select Pattern field, select Record Based.
    4. In the Required Properties section, click Add.
    5. Enter the following name-value pairs:
      recordcount           50
      TransactionTimeOut    20
    6. Click Finish to return to the Batch Job Step page of the wizard
    Screen capture of the dialog box where you can enter the properties of a Checkpoint algorithm.
  15. Create a Result Algorithm.
    This example uses the Job Sum pattern toto return the highest return code of all of the job steps in the job.
    1. Click Add next to Result Algorithm.
      The Result Algorithm wizard opens.
    2. Enter a name. We have used jobsum in this example.
    3. In the Select Pattern field, select Job Sum.
      The Job Sum pattern does not have any required properties.
    4. Click Finish to return to the Batch Job Step page of the wizard.
    Screen capture of the dialog box where you can enter the properties of a new Result algorithm.
  16. Click Next.
  17. Create a Step Input Stream.
    This example uses the VsamKsdsReaderImpl interface.
    1. Enter a name for the input stream. This example uses inputStream.
    2. Set Select pattern to Custom Stream.
    3. Set the Implementation class. Click browse, search for and select VsamKsdsReader located in the com.ibm.cics.batch.bds.impl package.
    4. In the Required properties section, click Add and enter the following name-value pairs:
      CICSFILE        BATCHIN
      KEYLENGTH       4
      START           F0F0F0F0
    Screen capture of the input stream dialog box where you can enter the input stream properties for a job step.
  18. Click Next.
  19. Create a Step Output Stream.
    This example uses the VsamKsdsRecordUpdaterImpl interface.
    1. Enter a name for the output stream. This example uses outputStream.
    2. Set Select pattern to Custom Stream.
    3. Set the Implementation class to com.ibm.cics.batch.bds.impl.VsamKsdsRecordUpdaterImpl.
    4. In the Required properties section, click Add and enter the following name-value pair:
      CICSFILE        BATCHOUT
      
    Screen capture of the input stream dialog box where you can enter the output stream properties for a job step.
  20. Click Finish.
  21. Open the xJCL editor. Change the default application name to the name of your new batch job, MyBatchJob.
    Screen capture of the xJCL editor.
    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.
Screen capture of the Batch Job xml file that was created by the wizard.

You can now edit the batch job Java file, for example, to call an existing COBOL batch job.
Screen capture of the Java file that was created by the wizard for the batch application
Note: You can check the return code of the job step for one of the values in the class BatchConstants. See Class BatchConstants.