• User's guide
  • API
Search Results for

    Show / Hide Table of Contents
    • Concepts
    • Installation
    • Configuration
      • Overview
      • License
      • Datasources
      • Configuration
      • Plug-Ins
      • Codepages
      • Environment Variables
      • Include files
      • Example
    • Jobs
      • Jobs
      • Include
      • Multi-Threaded Jobs
      • Tracking Jobs
    • Tasks
      • Overview
      • Copy Check
      • Excel
      • Execute
      • File Compare
      • File Copy
      • File Dump
      • File Edit
      • File Format
      • Foreach
      • Generate
      • IMS/DB Data Conversion
      • JCL Submit
      • Listcat
      • Log
      • Powershell
      • Set Environment Variable
      • Sql
      • Stored Procedure Compare
      • Table Compare
      • Table Copy
      • Table Load
      • Table Scan
      • Table Unload
      • User Script
    • Layouts
      • Overview
      • XML Definition
      • COBOL Definition
      • Field data Types
    • Extensibility
      • Extending Ianus
      • Column Comparators
      • Column Converters
      • Record Comparators
      • File Editors
      • User Script
      • Record Layout Match Class
      • Column Layout Match Class
      • User Fields
      • Codepages
      • Resources
    • Usage
      • Command Line
      • Monitors
      • Programmatically
      • Unit Testing
      • Docker
    • Known Issues
    • Disclaimers

    Column Comparator

    Table Compare and Stored Procedure Compare can be customized with user logic to compare columns.

    Such logic must be coded in a column comparator class which must implement the HPE.Ianus.Scripting.IColumnComparator interface.

    namespace HPE.Ianus.Scripting
    {
        public interface IColumnComparator
        {
            void Initialize(Environment env, Task task, DBFieldPair pair);
    
            int Compare(object lo, object ro);
        }
    }
    

    Therefore it must implement the method Compare, that takes care of comparing the left and right columns and return the comparison result.

    The method Compare receives the following input parameters:

    Parameter Description
    left Left value
    right Right value

    Once data is compared, the method should return an integer value indicating the comparison result:

    |Return code |Meaning |<0 |The left column is less than right record (left < right) |0 |Columns are equal (left=right) |>0 |The right column is greater than left column (left > right)

    The comparator class can be coded in C# when embedded as script, and in any .NET language (including COBOL if available) when provided as DLL.

    Note

    Ianus provides data to the Compare method exactly as it reads from the ADO resultset.

    Example

        public class StringCompareIgnoreCase : IColumnComparator
        {
            public void Initialize(HPE.Ianus.Environment env, HPE.Ianus.Task task, DBFieldPair pair)
            {
            }
    
            public int Compare(object lo, object ro)
            {
                string l = (string)lo;
                string r = (string)ro;
                return String.Compare(l.Replace('@','.'), r, true);
            }
        }
    
    In This Article
    Back to top Copyright 2021 - Hewlett-Packard Enterprise