Building Decisions

About this task

The Decisions feature enables automated text replacement in source files before they are scanned. By applying regular expression–based search-and-replace rules during preprocessing, you can standardize code patterns, ignore unwanted constructs, or you can temporarily modify code structure before analysis.
Note: No permanent changes are made to the original code files.

Supported languages

The decisions feature is available for:
  • COBOL programs
  • PL/I programs
How it works
  1. Configuration: Define decision rules in your .dat configuration file.
  2. Pattern matching: When a file is scanned, the system verifies whether any decision rules are applied to it.
  3. Temporary file creation: If matches are found, a temporary file is created with the specified replacements applied (named .temp_<original filename>).
  4. Scanning: The scanner processes the temporary file instead of the original file.
  5. Cleanup: Temporary files are automatically deleted after scanning (configurable).

Configuration

To enable the feature, add the following flag to the .dat configuration file:
OPTION_DECISIONS=1

Defining Decision Rules

Create a decisions section in the .dat file with one or more decision entries:
[DECISIONS]
DECISION01=<path>,filter(<file_pattern>),find_what(<regex_pattern>),replace_with(<replacement_text>)
DECISION02=<path>,filter(<file_pattern>),find_what(<regex_pattern>),replace_with(<replacement_text>)
DECISION03=<path>,filter(<file_pattern>),find_what(<regex_pattern>),replace_with(<replacement_text>)

Decision Entry Formats

Each decision entry consists of four components:
  1. Path: Directory containing the source files
    • Example: /wca4z-understand/IBM Application Discovery Build Client CLI/projects/ProjectName/zOS Cobol/
  2. Filter: File patterns to match
    • Single pattern:
      • Filter by extension (*.CBL)
      • Filter by name (ABC*.*)
      • Filter by both (A*CD.CBL)
    • Multiple patterns: filter (*.CBL | *.CBS)
      • Filter by extension (*.CBL | *.CBS)
      • Filter by name (ABC*.* | *BC.* | A*C.*)
      • Filter by both (A*CD.CBL | *BCD.CBL | ABC*.CBS)
    • All files: filter ( * )
  3. Find Pattern: Regular expression to search for
    • Example: find_what (\$[BD]YNCALL\$)
    • Uses standard regex syntax
  4. Replacement Text: Text to replace matched patterns
    • Example: replace_with (CALL)
    • Can be left empty to ignore the matched text entirely: replace_with()
Note: For troubleshooting, this feature includes an optional setting that allows you to retain intermediate files generated during processing. Keeping these files can assist in identifying the root cause of issues if unexpected behavior occurs.

Temporary File Cleanup

Following options allows you to control the temporary files that are deleted after scanning:
OPTION_DEL_DECISION_INTERIM_FILE=0 # Keep temp files for debugging