• 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

    Record Comparator

    File Compare can be customizied with user logic to compare columns, custom logic for the record comparison can be provided.

    Such logic must be coded in a a record comparator which must implement the HPE.Ianus.Scripting.IRecordComparator interface.

    namespace HPE.Ianus.Scripting
    {
        public interface IRecordComparator
        {
            int Compare(LoggerFacade log, Record left, Record right);
        }
    }
    

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

    The method Compare receives the following input parameters:

    Parameter Description
    log LoggerFacade object to write entries in the job log
    left Left Record object
    right Right Record object

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

    Return code Meaning
    <0 The left record is less than right record (left < right)
    0 Records are equal (left=right)
    >0 The right record is greater than left record (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 files. Therefore, in case of EBCDIC files, the user code needs to handle any necessary code page conversion.

    Example

    namespace ExternalCompareCS
    {
        public class TestComparator01 : HPE.Ianus.Scripting.IRecordComparator
        {
            public int Compare(LoggerFacade log, Record left, Record right)
            {
                return left.Bytes[0].CompareTo(right.Bytes[0]);
            }
        }
    }
    
    In This Article
    Back to top Copyright 2021 - Hewlett-Packard Enterprise