Using a Business Rule Flow in a Job

Overview

The Business Rules transformation enables you use the business rule flow packages that are created in SAS® Business Rules Manager in the context of a SAS Data Integration Studio job. You can import business rule flows, specify flow versions, map source table columns to required input columns, and set business rule options.
The transformation enables you to map your source data and output data into and out of the rules package. Then, the SAS Data Integration Studio job applies the rules to your data as it is run. When a job that contains a rules package is run, statistics are collected about the following:
  • how many rules were triggered
  • the number of invalid and valid data record values
  • other details
You can use this information to further refine your data as it flows through your transformation logic.
You must satisfy the following prerequisites before you can use the Business Rules transformation in a SAS Data Integration Studio job:
  • One or more business rule flows must have been created in SAS® Business Rules Manager. The outputs created for one of these business rule flows determine the outputs for the Business Rule transformation that the flow is used in a job.
  • These flows must be available in the Folders tree in SAS Data Integration Studio. A typical path through the Folders tree is Foldersthen selectProductsthen selectSAS Business Rules Studiothen selectBusiness Rule Flows 1.

Problem

You want to use a business rule flow to structure the analysis of some of your data.

Solution

You can create a SAS Data Integration Studio job that contains the Business Rules transformation. Perform the following tasks:

Tasks

Verify Prerequisites

The SAS Business Rules Manager must be installed on the server where the job that contains the Business Rules transformation is executed. Verify that this prerequisite has been satisfied.

Create the Job

Perform the following steps to create a job that uses a business rule flow:
  1. Create an empty SAS Data Integration Studio job.
  2. Navigate to the SAS Business Rules Studio folder on the Folders tab, and open the folder that contains the business rule flow that you want to use.
  3. Select the business rule flow and drop it in the empty job on the Diagram tab in the Job Editor window. A Business Rules transformation populated with the selected business rule flow is displayed on the tab.
    Note: You can also drop a Business Rules transformation directly onto the Diagram tab. However, you must then open the Business Rule tab in the transformation and select the flow in the Business rule flow field.
  4. Locate the source table that contains the data that you want to process in the business rule flow. The source table for the sample job is named CARS.
  5. Drop the source table onto the Diagram tab and connect it to the Business Rules transformation.
  6. Right-click the Business Rules transformation and click Expand in the pop-up menu. This step expands the outputs so that you can easily review them.
    The following display shows the completed job flow:
    Business Rules Flow
    Business Rules Flow

Configure the Job

You need to ensure that the business rule flow was properly populated and mapped when you created the job.
First, you should check the Business Rule tab, as shown in the following display:
Business Rule Tab
Business Rule Tab
You can see that version 1.1 the DIStudioTest2 flow has been populated into the Business Rules transformation. If necessary, you can select a new business rule flow and version in the appropriate fields.
You should also review the Inputs and Outputs tab, as shown in the following display:
Inputs and Outputs Tab
Inputs and Outputs Tab
Make sure that the Inputs column in the source table is mapped to the corresponding term in the business rule flow input. You also should examine the business rule flow outputs at the bottom of the tab. If necessary, you can add tables and select additional columns.

Run the Job and Review the Results

Run the job and verify that the job completes without error. Then, open the output tables to verify that the expected data is populated.
Note: By default the Business Rules transformation will generate a rule fire action table. With large data volumes or frequent rule triggers, the rule fire action table can grow large enough to impact system performance. If that happens, you can turn off the generation of the rule fire action table. To do so, open the properties window for the Business Rule transformation. Then, click the Options tab and the Business Rule Flow Advanced Options section of the tab. Select No in the drop-down menu in the Generate rules fired table field.

Usage Notes

The temporary work tables for the Business Rule transformation should be left in SAS data set format. Otherwise, the transformation might fail.
Transformations in a job typically create temporary work tables as they execute. The default work tables are SAS data sets in the SAS WORK library. You can redirect these temporary tables to an alternative format and location, as described in Redirecting Temporary Output Tables. However, the temporary work tables for the Business Rule transformation should be left in SAS data set format.
If a job with a Business Rule transformation fails with errors, try turning off the Enable optional metadata macro variables option for the job. This option is required when the job is executed on a SAS 9.1 Workspace Server, but it is not required if the job is executed on a newer server. To turn off this option for one job, perform the following steps.
  1. Open the job in the process editor.
  2. Right-click the canvas of the job and select Properties. The properties window for the job appears.
  3. Click the Options tab.
  4. Deselect the Enable optional metadata macro variables option.
  5. Click OK to save your changes.
  6. Run the job.
If the job now runs without error, consider turning off the Enable optional metadata macro variables option at the global level so that this option is turned off for all new jobs. To turn off this option for all new jobs, perform the following steps.
  1. Select Tools then selectOptions from the main menu.
  2. Click the Code Generation tab.
  3. Deselect the Enable optional metadata macro variables option.
  4. Click OK to save your changes.