Sample: Generating a COBOL program from a rule project

In this sample, you learn how to generate a COBOL program to run a rule project, and a job control language (JCL) to compile and run the compiled COBOL program.

Before you begin

The following limitations apply to the method shown in this sample:
  • This method works with rule projects made in Operational Decision Manager. It does not work with Decision Intelligence Client Managed Software or Decision Manager Open Edition projects.
  • The compiler JCL might need changes to reflect your COBOL installation.
  • Rule projects with multiple execution object models (XOMs) or copybooks might not create the right project.
  • Complicated XOMs and copybooks (nested lists and objects) might create large and possibly unstable samples.

About this task

This sample shows you how to quickly create a working sample of a COBOL program from a rule project.

Procedure

  1. Start with a Java™ XOM or COBOL copybook, and create a marshalled rule project in Rule Designer.
  2. When a copybook is imported (or generated in the XOM > COBOL path), a sample copybook is also created in resources/cobol/sample/<name>_sample.cpy.
    • To create this sample project in an existing rule project, update the COBOL XOM or COBOL-enabled BOM in the COBOL management section of the properties for rule projects.
    • The project is not editable, so any changes in Eclipse do not effect the deployed rule project.
  3. When you then deploy this rule project to Rule Execution Server (RES), the sample copybook(s) are included in the project.
  4. In z/OS®, set these properties in HBRCMMN:
    • HBRPORT: The port to call the API
    • RESDEPLOYUSER: The RES username
    • RESDEPLOYPASSWORD: The RES password (RESDEPLOYPASSENCR can also used if the password has been encrypted by HBRPWDEN.)
    • HBRHLQ
  5. Call HBRLIST to list all the current deployments.
  6. Call HBRGEN to generate a sample COBOL program.
    The program is populated with the following sample parameters:
    • ACTION: The action the program does (LIST-ODM-DEPLOYMENTS and GENERATE-ODM-SAMPLE )
    • INCLUDE-VERSIONS: Set for whether the LIST call shows specific version numbers
    • RULEAPP_PATH: The path to the RuleApp to create the sample off of (or similar), in the same format as returned from HBRLIST
    • TARGET_JCL_DATASET: The output dataset for generated JCL
    • TARGET_COBOL_DATASET: The output dataset for generated COBOL
    • TARGET_COPYBOOK_DATASET: The output dataset for the sample copybook
    • PROGRAM_NAME: The name of the output program and JCL
    • OVERWRITE: True if any existing datasets should be overwritten when creating the new ones
    • COPYBOOK_INLINE: True if the copybook should be included in the COBOL program, false if separate
    • JCL-JOBCARD: The header for the generated JCLs
    • COMPILE_JCL: True/False Should the compile JCL is generated. Makes the following parameters required.
    • TARGET_COMPILED_COPYBOOK_DATASET: The output dataset for the compiled COBOL program this will need to be created before
    • COBOL_COMPILER_LOCATION: Where your installation of the COBOL compiler is
    • WAS_LOADLIB_LOCATION: (Optional) WAS loadlib location
  7. After HBRGEN runs, the COBOL code is generated along with the JCL specified in the parameters.
  8. Compile the COBOL code either manually or by using the JCL COMPSAMP in TARGET_JCL_DATASET (if COMPILE_JCL is set to true in the parameters of HBRGEN)
  9. Run the compiled COBOL with the generated JCL that is found in TARGET_JCL_DATASET.

Results

You now have a working sample of a COBOL program from a rule project.