• 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
      • 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
    • Known Issues
    • Disclaimers

    API

    Ianus can be embedded and invoked by a .NET application. You need to add an assembly reference to the visual studio project for the Ianus assembly (HPE.Ianus.DLL) and then make use of the Ianus classes to run Ianus jobs.

    The usage is pretty simple and requires a few steps:

    1. Create an instance of the Ianus environment using the class HPE.Ianus.Environment
    2. Create an instance of the job(s) you want to execute, using the class HPE.Ianus.Job
    3. Run the jobs or execute one or more specific steps
    4. Verify the result of the job or of one or more specific steps

    Creating the Environment instance

    The environment instance is loaded from an existing Environment configuration that can be stored in an external XML file or in a XML resource file include in the generated assembly.

    HPE.Ianus.Environment env = new HPE.Ianus.Environment(new FileInfo(@"C:\IANUS\Env.xml"));
    
    HPE.Ianus.Environment env = new HPE.Ianus.Environment(Assembly.GetExecutingAssembly(),                
                                                  "Ianus_Unit_Test.EmbeddedEnv.xml");
    

    Creating the Job instance

    Like the environment, jobs can be loaded from job files stored either on regular files or embedded resources.

    Job job01 = new Job(env, new FileInfo(@"C:\IANUS\ZZFILE_EXTERNAL_MATCH.xml"));
    
    Job job02 = new Job(env, Assembly.GetExecutingAssembly(), "Ianus_Unit_Test.EmbeddedConfig.xml");
    

    Running the Job

    You can either run the whole job or just selected steps. To run the entire job all you need to do is to invoke the Run method.

    To run specific steps, you need to use the following sequence of operations:

    • Invoke the Start method
    • Invoke the Execute method for every step you want to process
    • Invoke the End method
    Job job01 = new Job(env, new FileInfo(@"C:\IANUS\ZZFILE_EXTERNAL_MATCH.xml"));
    job01.Run();
    
    Job job02 = new Job(env, Assembly.GetExecutingAssembly(), 
                             "Ianus_Unit_Test.EmbeddedConfig.xml");
    job.Start();
    job.Execute("TBLCMP01"); // executing step named TBLCMP01
    job.Execute("TBLCMPAA"); // executing step named TBLCMPAA
    job.End();
    

    Checking the job and steps status code

    Once the job has been executed, the Status Code of the job can be controlled using the property Status.

    To check the status of selected tasks, the Job object exposes the Tasks collection that can be used to access the desired task. The task status code is provided by the property Status.

    Job job = new Job(env, Assembly.GetExecutingAssembly(), "Ianus_Unit_Test.EmbeddedConfig.xml");
    job.Run()
    Assert.AreEqual(Ianus.Job.JobStatus.Success, job.Status);
    
    Job job = new Job(env, Assembly.GetExecutingAssembly(), "Ianus_Unit_Test.EmbeddedConfig.xml");
    job.Run();
    Assert.AreEqual(Ianus.Task.TaskStatus.Success, job.Tasks["LOGERR"].Status);
    Assert.AreEqual(Ianus.Task.TaskStatus.Success, job.Tasks["LOGWARN"].Status);
    Assert.AreEqual(Ianus.Task.TaskStatus.Success, job.Tasks["LOGINFO"].Status);
    
    In This Article
    Back to top Copyright 2021 - Hewlett-Packard Enterprise