.NET Framework Functions


All XML streams are described in detail here.

Link2iOptions parameter

Link2iOptions

Common options parameter with embedded connection information and execution messages

Description

This type is used in many LINK2i functions as a unique parameter containing connection information and allowing the user to follow the execution through an ExitMessage attribute

Attributes
  • ConnectionString string
    Connection string generated using GetConnectionString() function
  • SessionID string
    24 alphanumeric characters string used to identify the current session (arbitrary)
  • ExitMessage string
    Error/success message
  • LicenseSummary string
    Current license information

Link2i.Link2iOptions options = new Link2i.Link2iOptions(){
    ConnectionString = "kjhv....",
    SessionId = "user00001session25072021"
};
                    

Dim options As Link2i.Link2iOptions = New Link2i.Link2iOptions() With {
    .ConnectionString = "kjhv....",
    .SessionId = "user00001session25072021"
}

About Link2i

Version

Gets Link2i version

Description

This function retrieves Link2i version level

Parameters
    Returns
    • Version() string
      Formatted character string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    
    //Function call
    result = db2.Version();
    
    //Returned results
    result = "LINK2i - V1R0M9 - March 14 2022 - www.aumerial.com/Knowledge.aspx";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    
    'Function call
    result = db2.Version()
    
    'Returned results
    result = "LINK2i - V1R0M9 - March 14 2022 - www.aumerial.com/Knowledge.aspx"
                        

    Create connection strings

    RegisterLicenseKey

    Register Link2i license key

    Description

    Create KLINK2I, KLINK2T libraries, LICLINK file and Register Link2i license key OR Update license key and get in return a diagnosis message

    Parameters
    • lparIP string
      Logical partition IP address that will work with Link2i
    • usrName string
      Existing user name on IBM i
    • usrPassword string
      Password of the user name
    • licenseKey string
      License key supplied by Aumerial as characters string
    • createOrRenew string
      'CRT' or 'UPDT' depending on whether you are registering a license key or updating an existing one
    Returns
    • RegisterLicenseKey() string
      IBM i diagnosis message as string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    string lparIP = "192.168.2.19";
    string usrName = "QSECOFR";
    string usrPassword = "PW1234";
    string licenseKey = "...mpoOuLXn3D6WnjAjk=…";
    string createOrRenew = "Link2i.TypeRegister.CRT";
    
    //Function call
    result = db2.RegisterLicenseKey(lparIP, usrName, usrPassword, licenseKey, createOrRenew);
    
    //Returned results
    result = "";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim lparIP As String = "192.168.2.19"
    Dim usrName As String = "QSECOFR"
    Dim usrPassword As String = "PW1234"
    Dim licenseKey As String = "...mpoOuLXn3D6WnjAjk=…"
    Dim createOrRenew As String = "Link2i.TypeRegister.CRT"
    
    'Function call
    result = db2.RegisterLicenseKey(lparIP, usrName, usrPassword, licenseKey, createOrRenew)
    
    'Returned results
    result = ""
                        

    GetConnectionString

    Create a connection string

    Description

    LINK2i functions require an encrypted connection string containing the IP address, session credentials (user name/user password/ user name of an IBM i *SECOFR account/ password corresponding to the *SECOFR user name) and date of lifetime end of the connection string. This connection string is generated using GetConnectionString. The IBM i access is limited to the security roles established in the IBM i for the specified account.

    Parameters
    • IP string
      IP address or network location of the targeted IBM i partition
    • usrName string
      Existing user name on IBM i
    • usrPassword string
      Password of the user name
    • secofrUsr string
      User name of an IBM i *SECOFR account
    • secofrPwd string
      Password corresponding to the *SECOFR username
    • connectionStringLifeTime string
      Date of lifetime end of the connection string in ddmmyyyy format (blanks if no limit)
    Returns
    • GetConnectionString() string
      LINK2i connection string as string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    string IP = "192.168.2.19";
    string usrName = "QSECOFR";
    string usrPassword = "PW1234";
    string secofrUsr = "S44H3440";
    string secofrPwd = "LPAR001";
    string connectionStringLifeTime = "31122023";
    
    //Function call
    result = db2.GetConnectionString(IP, usrName, usrPassword, secofrUsr, secofrPwd, connectionStringLifeTime);
    
    //Returned results
    result = "connection string to use in other functions";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim IP As String = "192.168.2.19"
    Dim usrName As String = "QSECOFR"
    Dim usrPassword As String = "PW1234"
    Dim secofrUsr As String = "S44H3440"
    Dim secofrPwd As String = "LPAR001"
    Dim connectionStringLifeTime As String = "31122023"
    
    'Function call
    result = db2.GetConnectionString(IP, usrName, usrPassword, secofrUsr, secofrPwd, connectionStringLifeTime)
    
    'Returned results
    result = "connection string to use in other functions"
                        

    Explore targeted IBM i partition

    These functions allow you to explore the targeted IBM i partition to get a quick in-depth overview of what's inside your machine. They can also be used to interact with other LINK2i functions to specify libraries, files, create user-friendly query wizards...

    AboutLink2iLicense

    retrieve licence status

    Description

    retrieves licence status

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    Returns
    • AboutLink2iLicense() string
      Formatted message to warn about licence validity expressed in remaining days
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    
    //Function call
    result = db2.AboutLink2iLicense(Options);
    
    //Returned results
    result = "";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim Options As New Link2i.Link2iOptions
    
    'Function call
    result = db2.AboutLink2iLicense(Options)
    
    'Returned results
    result = ""
                        

    GetSerialNumberIBMi

    retrieve targeted IBM i serial number and OS details

    Description

    Retrieves targeted IBM i serial number and the OS details.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    Returns
    • GetSerialNumberIBMi() string
      IBM i information as string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    
    //Function call
    result = db2.GetSerialNumberIBMi(Options);
    
    //Returned results
    result = "";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim Options As New Link2i.Link2iOptions
    
    'Function call
    result = db2.GetSerialNumberIBMi(Options)
    
    'Returned results
    result = ""
                        

    ListDatabases

    Databases/Libraries inventory

    Description

    ListDatabases extracts a list of all databases/libraries from the targeted IBM i partition in an object type variable that can be used as datasource. The variable contains databases list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    Returns
    • ListDatabases() object
      List as object type variable
    
    //Parameters
    Link2i db2 = new Link2i();
    object result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    
    //Function call
    result = db2.ListDatabases(Options);
    
    //Returned results
    result; //<Array of databases>
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As Object
    Dim Options As New Link2i.Link2iOptions
    
    'Function call
    result = db2.ListDatabases(Options)
    
    'Returned results
    result '<Array of databases>
                        

    ListDatabasesXML

    Databases/Libraries inventory

    Description

    ListDatabases extracts a list of all databases/libraries from the targeted IBM i partition in an XML stream containing databases list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    Returns
    • ListDatabasesXML() string
      List as XML string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    
    //Function call
    result = db2.ListDatabasesXML(Options);
    
    //Returned results
    result = "<Databases>...</Databases>";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim Options As New Link2i.Link2iOptions
    
    'Function call
    result = db2.ListDatabasesXML(Options)
    
    'Returned results
    result = "<Databases>...</Databases>"
                        

    ListTables

    Tables/files inventory in a database/library

    Description

    ListTables extracts a list of all tables/files of the specified database/library from the targeted IBM i partition in an object type variable that can be used as datasource. The variable contains tables list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Name of the database/library whose tables/files are to be listed
    Returns
    • ListTables() object
      List as object type variable
    
    //Parameters
    Link2i db2 = new Link2i();
    object result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    
    //Function call
    result = db2.ListTables(Options, base);
    
    //Returned results
    result; //<Array of tables in a database>
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As Object
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    
    'Function call
    result = db2.ListTables(Options, base)
    
    'Returned results
    result '<Array of tables in a database>
                        

    ListTablesXML

    Tables/files inventory in a database/library

    Description

    ListTables extracts a list of all tables/files of the specified database/library from the targeted IBM i partition in an XML stream containing tables list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Name of the database/library whose tables/files are to be listed
    Returns
    • ListTablesXML() string
      List as XML string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    
    //Function call
    result = db2.ListTablesXML(Options, base);
    
    //Returned results
    result = "<Tables>...</Tables>";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    
    'Function call
    result = db2.ListTablesXML(Options, base)
    
    'Returned results
    result = "<Tables>...</Tables>"
                        

    ListFields

    Fields inventory in a table/file

    Description

    ListFields extracts a list of all fields of the specified table/file of the specified database/library from the targeted IBM i partition in an object type variable that can be used as datasource. The variable contains fields list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Database/library containing the table/file whose fields are to be listed
    • table string
      Table/file whose fields are to be listed
    Returns
    • ListFields() object
      List as object type variable
    
    //Parameters
    Link2i db2 = new Link2i();
    object result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    string table = "TABLETEST";
    
    //Function call
    result = db2.ListFields(Options, base, table);
    
    //Returned results
    result; //<Array of fields in a table>
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As Object
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    Dim table As String = "TABLETEST"
    
    'Function call
    result = db2.ListFields(Options, base, table)
    
    'Returned results
    result '<Array of fields in a table>
                        

    ListFieldsXML

    Fields inventory in a table/file

    Description

    ListFields extracts a list of all fields of the specified table/file of the specified database/library from the targeted IBM i partition in an XML stream containing fields list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Database/library containing the table/file whose fields are to be listed
    • table string
      Table/file whose fields are to be listed
    Returns
    • ListFieldsXML() string
      List as XML string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    string table = "TABLETEST";
    
    //Function call
    result = db2.ListFieldsXML(Options, base, table);
    
    //Returned results
    result = "<Fields>...</Fields>";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    Dim table As String = "TABLETEST"
    
    'Function call
    result = db2.ListFieldsXML(Options, base, table)
    
    'Returned results
    result = "<Fields>...</Fields>"
                        

    ListPrograms

    Inventory of programs of a database

    Description

    ListPrograms extracts a list of all programs of the specified database/library from the targeted IBM i partition in an object type variable that can be used as datasource. The variable contains programs list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Database/library whose programs are to be listed
    Returns
    • ListPrograms() object
      List as object type variable
    
    //Parameters
    Link2i db2 = new Link2i();
    object result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    
    //Function call
    result = db2.ListPrograms(Options, base);
    
    //Returned results
    result; //<Array of programs in a database>
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As Object
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    
    'Function call
    result = db2.ListPrograms(Options, base)
    
    'Returned results
    result '<Array of programs in a database>
                        

    ListProgramsXML

    Inventory of programs of a database

    Description

    ListPrograms extracts a list of all programs of the specified database/library from the targeted IBM i partition in an XML stream containing programs list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Database/library whose programs are to be listed
    Returns
    • ListProgramsXML() string
      List as XML string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    
    //Function call
    result = db2.ListProgramsXML(Options, base);
    
    //Returned results
    result = "<Programs>...</Programs>";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    
    'Function call
    result = db2.ListProgramsXML(Options, base)
    
    'Returned results
    result = "<Programs>...</Programs>"
                        

    ListSources

    Inventory of source files of a database

    Description

    ListSources extracts a list of all source files of the specified database/library from the targeted IBM i partition in an object type variable that can be used as datasource. The variable contains sources list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Database/library whose source files are to be listed
    Returns
    • ListSources() object
      List as object type variable
    
    //Parameters
    Link2i db2 = new Link2i();
    object result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    
    //Function call
    result = db2.ListSources(Options, base);
    
    //Returned results
    result; //<Array of sources in a database>
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As Object
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    
    'Function call
    result = db2.ListSources(Options, base)
    
    'Returned results
    result '<Array of sources in a database>
                        

    ListSourcesXML

    Inventory of source files of a database

    Description

    ListSources extracts a list of all source files of the specified database/library from the targeted IBM i partition in an XML stream containing sources list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Database/library whose source files are to be listed
    Returns
    • ListSourcesXML() string
      List as XML string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    
    //Function call
    result = db2.ListSourcesXML(Options, base);
    
    //Returned results
    result = "<Sources>...</Sources>";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    
    'Function call
    result = db2.ListSourcesXML(Options, base)
    
    'Returned results
    result = "<Sources>...</Sources>"
                        

    ListMembers

    Inventory of source members of a source file of a database

    Description

    ListMembers extracts a list of all members of the specified source file of the specified database/library from the targeted IBM i partition in an object type variable that can be used as datasource. The variable contains members list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Database/library whose members are to be listed
    • srcFile string
      Source file whose members are to be listed
    Returns
    • ListMembers() object
      List as object type variable
    
    //Parameters
    Link2i db2 = new Link2i();
    object result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    string srcFile = "SOURCETEST";
    
    //Function call
    result = db2.ListMembers(Options, base, srcFile);
    
    //Returned results
    result; //<Array of members in a source file>
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As Object
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    Dim srcFile As String = "SOURCETEST"
    
    'Function call
    result = db2.ListMembers(Options, base, srcFile)
    
    'Returned results
    result '<Array of members in a source file>
                        

    ListMembersXML

    Inventory of source members of a source file of a database

    Description

    ListMembers extracts a list of all members of the specified source file of the specified database/library from the targeted IBM i partition in an XML stream containing members list.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Database/library whose members are to be listed
    • srcFile string
      Source file whose members are to be listed
    Returns
    • ListMembersXML() string
      List as XML string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    string srcFile = "SOURCETEST";
    
    //Function call
    result = db2.ListMembersXML(Options, base, srcFile);
    
    //Returned results
    result = "<Members>...</Members>";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    Dim srcFile As String = "SOURCETEST"
    
    'Function call
    result = db2.ListMembersXML(Options, base, srcFile)
    
    'Returned results
    result = "<Members>...</Members>"
                        

    GetObjectDetails

    Details of an IBM i object

    Description

    GetObjectDetails retrieves details of any IBM i object in an object type variable that can be used as datasource, containing parameters and their captions.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Database/library containing the IBM i object
    • ibmObject string
      IBM i object Name
    • objType string
      IBM i object type (*PGM, *FILE, *DEVD, etc...)
    Returns
    • GetObjectDetails() object
      Data as object type variable
    
    //Parameters
    Link2i db2 = new Link2i();
    object result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    string ibmObject = "OBJTEST";
    string objType = "*PGM";
    
    //Function call
    result = db2.GetObjectDetails(Options, base, ibmObject, objType);
    
    //Returned results
    result; //<Array of object details in a database>
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As Object
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    Dim ibmObject As String = "OBJTEST"
    Dim objType As String = "*PGM"
    
    'Function call
    result = db2.GetObjectDetails(Options, base, ibmObject, objType)
    
    'Returned results
    result '<Array of object details in a database>
                        

    GetObjectDetailsXML

    Details of an IBM i object

    Description

    GetObjectDetails retrieves details of any IBM i object in an XML stream containing parameters and their captions.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • base string
      Database/library containing the IBM i object
    • ibmObject string
      IBM i object Name
    • objType string
      IBM i object type (*PGM, *FILE, *DEVD, etc...)
    Returns
    • GetObjectDetailsXML() string
      Data as XML string
    
    //Parameters
    Link2i db2 = new Link2i();
    string result;
    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
    string base = "LIBTEST";
    string ibmObject = "OBJTEST";
    string objType = "*PGM";
    
    //Function call
    result = db2.GetObjectDetailsXML(Options, base, ibmObject, objType);
    
    //Returned results
    result = "<objectDetails>...</objectDetails>";
                        
    
    'Parameters
    Dim db2 As New Link2i
    Dim result As String
    Dim Options As New Link2i.Link2iOptions
    Dim base As String = "LIBTEST"
    Dim ibmObject As String = "OBJTEST"
    Dim objType As String = "*PGM"
    
    'Function call
    result = db2.GetObjectDetailsXML(Options, base, ibmObject, objType)
    
    'Returned results
    result = "<objectDetails>...</objectDetails>"
                        

    Database

    Run SQL queries and retrieve data in standard structures (XML, DataTable objects) to integrate DB2 for i databases in any environment. Extract and export data in CSV, TXT and XLSX files.

    RunSql

    Execute an SQL Query

    Description

    Runs an SQL query on the targeted IBM i.

    Parameters
    • Options Link2i.Link2iOptions
      Four connection options ***
    • sqlQuery string
      SQL query to execute
    Returns
      
      //Parameters
      Link2i db2 = new Link2i();
      Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
      string sqlQuery = "update libtest.tabletest set name = 'foo' where name = 'bar'";
      
      //Function call
      result = db2.RunSql(Options, sqlQuery);
      
      //Returned results
      
                          
      
      'Parameters
      Dim db2 As New Link2i
      Dim Options As New Link2i.Link2iOptions
      Dim sqlQuery As String = "update libtest.tabletest set name = 'foo' where name = 'bar'"
      
      'Function call
      result = db2.RunSql(Options, sqlQuery)
      
      'Returned results
      
                          

      RunSqlByTen

      Execute multiple SQL queries

      Description

      Runs a sequence of up to 10 SQL queries in a row.

      Parameters
      • Options Link2i.Link2iOptions
        Four connection options ***
      • sqlQuery string
        SQL query to run
      • delimiter string
        Delimiter used between queries in sqlQuery parameter
      Returns
        
        //Parameters
        Link2i db2 = new Link2i();
        Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
        string sqlQuery = "update libtest.tabletest set name = 'foo' where name = 'bar';update libtest.tabletest set product = 'link2i' where machine = 'ibm i'";
        string delimiter = ";";
        
        //Function call
        result = db2.RunSqlByTen(Options, sqlQuery, delimiter);
        
        //Returned results
        
                            
        
        'Parameters
        Dim db2 As New Link2i
        Dim Options As New Link2i.Link2iOptions
        Dim sqlQuery As String = "update libtest.tabletest set name = 'foo' where name = 'bar';update libtest.tabletest set product = 'link2i' where machine = 'ibm i'"
        Dim delimiter As String = ";"
        
        'Function call
        result = db2.RunSqlByTen(Options, sqlQuery, delimiter)
        
        'Returned results
        
                            

        RunSqlScript

        Execute an SQL Query script

        Description

        Runs an SQL script. The script can either be composed of SQL queries and CL commands. CL commands must be prefixed by 'CX:' or 'CL:'.
        When using CX prefix, the script doesn't stop and resumes on error.
        When using CL prefix, the script is interrupted on error.

        The messages returned at each step of the script appear in the return parameter named diagMessage.

        Parameters
        • Options Link2i.Link2iOptions
          Four connection options ***
        • sqlScript string
          SQL script to execute
        • delimiter string
          Delimiter used between instructions in sqlScript parameter
        Returns
          
          //Parameters
          Link2i db2 = new Link2i();
          Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
          string sqlScript = "CL:CPYF(...);insert into ... ;CX:DLTF(...)";
          string delimiter = ";";
          
          //Function call
          result = db2.RunSqlScript(Options, sqlScript, delimiter);
          
          //Returned results
          
                              
          
          'Parameters
          Dim db2 As New Link2i
          Dim Options As New Link2i.Link2iOptions
          Dim sqlScript As String = "CL:CPYF(...);insert into ... ;CX:DLTF(...)"
          Dim delimiter As String = ";"
          
          'Function call
          result = db2.RunSqlScript(Options, sqlScript, delimiter)
          
          'Returned results
          
                              

          GetMassData

          Getting large volumes of data by an SQL SELECT query

          Description

          Performs mass data extraction to CSV file. GetMassData retrieves detailed description of each fields in the header of the file.

          Parameters
          • Options Link2i.Link2iOptions
            Four connection options ***
          • sqlQuery string
            SQL SELECT query (simple/join)
          • delimiter string
            CSV separator
          • nbrRec integer
            Number of records to extract
          • resultFilePath string
            Full path to the result file with suffix
          • chunk integer
            Chunking parameter affecting the overall speed of the process. Find more details here: www.knowledge.aumerial.com
          Returns
            
            //Parameters
            Link2i db2 = new Link2i();
            Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
            string sqlQuery = "select * from libtest.tabletest";
            string delimiter = ";";
            int nbrRec = 20000;
            string resultFilePath = "c:\extractions\extract.csv";
            int chunk = 500;
            
            //Function call
            result = db2.GetMassData(Options, sqlQuery, delimiter, nbrRec, resultFilePath, chunk);
            
            //Returned results
            
                                
            
            'Parameters
            Dim db2 As New Link2i
            Dim Options As New Link2i.Link2iOptions
            Dim sqlQuery As String = "select * from libtest.tabletest"
            Dim delimiter As String = ";"
            Dim nbrRec As Integer = 20000
            Dim resultFilePath As String = "c:\extractions\extract.csv"
            Dim chunk As Integer = 500
            
            'Function call
            result = db2.GetMassData(Options, sqlQuery, delimiter, nbrRec, resultFilePath, chunk)
            
            'Returned results
            
                                

            PutMassData

            Send large amounts of data to a single-field staging table for integration into DB2 for i using the CL CPYFRMIMPF command

            Description

            PutMassData uses a CSV file (with a separator). The CSV file must have values and types in the same position than the fields contained in the destination DB2 for i table. The separator must be an insignificant character on the CSV file values. An intermediate table with only one field must first be created in DB2 for i to receive the transferred data.

            Parameters
            • Options Link2i.Link2iOptions
              Four connection options ***
            • txtField string
              Name of the single-field on the staging table/file
            • base string
              Database/library containing the staging table/file
            • table string
              Name of staging Table/file
            • docCsv string
              Full path of CSV File to send
            • delimiter string
              Delimiter
            Returns
              
              //Parameters
              Link2i db2 = new Link2i();
              Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
              string txtField = "field01";
              string base = "libtest";
              string table = "tabletest";
              string docCsv = "c:\extractions\extract.csv";
              string delimiter = ";";
              
              //Function call
              result = db2.PutMassData(Options, txtField, base, table, docCsv, delimiter);
              
              //Returned results
              
                                  
              
              'Parameters
              Dim db2 As New Link2i
              Dim Options As New Link2i.Link2iOptions
              Dim txtField As String = "field01"
              Dim base As String = "libtest"
              Dim table As String = "tabletest"
              Dim docCsv As String = "c:\extractions\extract.csv"
              Dim delimiter As String = ";"
              
              'Function call
              result = db2.PutMassData(Options, txtField, base, table, docCsv, delimiter)
              
              'Returned results
              
                                  

              GetAllRecords

              Getting records of a table by an SQL SELECT query

              Description

              retrieves the result of an SQL SELECT query (simple/join) as a System.Data.DataTable object.

              Parameters
              • Options Link2i.Link2iOptions
                Four connection options ***
              • sqlQuery string
                SQL SELECT query (simple/join)
              • nbrRec integer
                Number of records to extract
              • sqlComplex string
                Complex SQL SELECT query to be executed before the SQL SELECT query (sqlQuery parameter), for example when using the FINAL TABLE statement
              Returns
              • GetAllRecords() System.Data.DataTable
                Data as System.Data.DataTable
              
              //Parameters
              Link2i db2 = new Link2i();
              System.Data.DataTable result = new System.Data.DataTable();
              Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
              string sqlQuery = "select ID, NAME, AGE from LIBTEST.TABLETEST WHERE age > 18";
              int nbrRec = 2500;
              string sqlComplex = "";
              
              //Function call
              result = db2.GetAllRecords(Options, sqlQuery, nbrRec, sqlComplex);
              
              //Returned results
              result; //
                                  
              
              'Parameters
              Dim db2 As New Link2i
              Dim result As New System.Data.DataTable
              Dim Options As New Link2i.Link2iOptions
              Dim sqlQuery As String = "select ID, NAME, AGE from LIBTEST.TABLETEST WHERE age > 18"
              Dim nbrRec As Integer = 2500
              Dim sqlComplex As String = ""
              
              'Function call
              result = db2.GetAllRecords(Options, sqlQuery, nbrRec, sqlComplex)
              
              'Returned results
              result '
                                  

              GetAllRecordsXML

              Getting records of a table by an SQL SELECT query

              Description

              retrieves the result of an SQL SELECT query (simple/join) in an XML stream.

              Parameters
              • Options Link2i.Link2iOptions
                Four connection options ***
              • sqlQuery string
                SQL SELECT query (simple/join)
              • nbrRec integer
                Number of records to extract
              • sqlComplex string
                Complex SQL SELECT query to be executed before the SQL SELECT query (sqlQuery parameter), for example when using the FINAL TABLE statement
              Returns
              • GetAllRecordsXML() string
                Data as XML string
              
              //Parameters
              Link2i db2 = new Link2i();
              string result;
              Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
              string sqlQuery = "select ID, NAME, AGE from LIBTEST.TABLETEST WHERE age > 18";
              int nbrRec = 2500;
              string sqlComplex = "";
              
              //Function call
              result = db2.GetAllRecordsXML(Options, sqlQuery, nbrRec, sqlComplex);
              
              //Returned results
              result = "";
                                  
              
              'Parameters
              Dim db2 As New Link2i
              Dim result As String
              Dim Options As New Link2i.Link2iOptions
              Dim sqlQuery As String = "select ID, NAME, AGE from LIBTEST.TABLETEST WHERE age > 18"
              Dim nbrRec As Integer = 2500
              Dim sqlComplex As String = ""
              
              'Function call
              result = db2.GetAllRecordsXML(Options, sqlQuery, nbrRec, sqlComplex)
              
              'Returned results
              result = ""
                                  

              GetRecord

              Getting fields values and names in a dictionary structured by an SQL SELECT query

              Description

              retrieves fields values and fields names returned by an SQL SELECT query (simple/join).

              Parameters
              • Options Link2i.Link2iOptions
                Four connection options ***
              • sqlQuery string
                SQL SELECT query (simple/join)
              • occurs string
                Pair of character strings (field name and field value) in a dictionary structure
              • sqlComplex string
                Complex SQL SELECT query to be executed before the SQL SELECT query (sqlQuery parameter), for example when using the FINAL TABLE statement
              Returns
              • GetRecord() string
                List of strings used to retrieve data
              • ref occurs string
              
              //Parameters
              Link2i db2 = new Link2i();
              string result;
              Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
              string sqlQuery = "SELECT NUMART,DESART,DOMAIN FROM newrmf.tarticle WHERE NUMART='2TS4F07800001A'";
              string occurs = String.Empty;
              string sqlComplex = "";
              
              //Function call
              result = db2.GetRecord(Options, sqlQuery, ref occurs, sqlComplex);
              
              //Returned results
              result = "NUMART;2TS4F07800001A
              DESART;YD.ZZN JUCK 185RC 46/51 33.47QQ
              DOMAIN;2"; occurs = "";
              
              'Parameters
              Dim db2 As New Link2i
              Dim result As String
              Dim Options As New Link2i.Link2iOptions
              Dim sqlQuery As String = "SELECT NUMART,DESART,DOMAIN FROM newrmf.tarticle WHERE NUMART='2TS4F07800001A'"
              Dim occurs As String = "
              Dim sqlComplex As String = ""
              
              'Function call
              result = db2.GetRecord(Options, sqlQuery, occurs, sqlComplex)
              
              'Returned results
              result = "NUMART;2TS4F07800001A
              DESART;YD.ZZN JUCK 185RC 46/51 33.47QQ
              DOMAIN;2" occurs = ""

              GetRecordXML

              Getting fields values and names in a dictionary structured by an SQL SELECT query

              Description

              retrieves fields values and fields names returned by an SQL SELECT query (simple/join) in an XML stream.

              Parameters
              • Options Link2i.Link2iOptions
                Four connection options ***
              • sqlQuery string
                SQL SELECT query (simple/join)
              • occurs string
                Pair of character strings (field name and field value) in a dictionary structure
              • sqlComplex string
                Complex SQL SELECT query to be executed before the SQL SELECT query (sqlQuery parameter), for example when using the FINAL TABLE statement
              Returns
              • GetRecordXML() string
                Data as a dictionary structure
              • ref occurs string
              
              //Parameters
              Link2i db2 = new Link2i();
              string result;
              Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
              string sqlQuery = "SELECT NUMART,DESART,DOMAIN FROM newrmf.tarticle WHERE NUMART='2TS4F07800001A'";
              string occurs = String.Empty;
              string sqlComplex = "";
              
              //Function call
              result = db2.GetRecordXML(Options, sqlQuery, ref occurs, sqlComplex);
              
              //Returned results
              result = "";
              occurs = "";
                                  
              
              'Parameters
              Dim db2 As New Link2i
              Dim result As String
              Dim Options As New Link2i.Link2iOptions
              Dim sqlQuery As String = "SELECT NUMART,DESART,DOMAIN FROM newrmf.tarticle WHERE NUMART='2TS4F07800001A'"
              Dim occurs As String = "
              Dim sqlComplex As String = ""
              
              'Function call
              result = db2.GetRecordXML(Options, sqlQuery, occurs, sqlComplex)
              
              'Returned results
              result = ""
              occurs = ""
                                  

              GetDataDescription

              Getting detailed description of data structured by an SQL SELECT query

              Description

              retrieves detailed description (type, size, ...) of data returned by an SQL SELECT query (simple/join).

              Parameters
              • Options Link2i.Link2iOptions
                Four connection options ***
              • sqlQuery string
                SQL SELECT query (simple/join)
              Returns
              • GetDataDescription() string
                List of strings used to retrieve data
              
              //Parameters
              Link2i db2 = new Link2i();
              string result;
              Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
              string sqlQuery = "SELECT NUMART,DESART,DOMAIN FROM newrmf.tarticle WHERE NUMART='2TS4F07800001A'";
              
              //Function call
              result = db2.GetDataDescription(Options, sqlQuery);
              
              //Returned results
              result = "NUMART;2TS4F07800001A
              DESART;YD.ZZN JUCK 185RC 46/51 33.47QQ
              DOMAIN;2
              ===============================================
              SELECT NUMART,DESART,DOMAIN FROM newrmf.tarticle WHERE NUMART='2TS4F07800001A'$§$NUMART$§$NUMART-A-NUMERO_ARTICLE$|$DESART-A-DESIGNATION$|$DOMAIN-A-CODE_DOMAINE$|$
              32-0-A-NUMERO_ARTICLE-NUMERO ARTICLE......-0-NUMERO ARTICLE......-NUMART-Y-NUMART$|$64-0-A-DESIGNATION-DESIGNATION.........-0-DESIGNATION.........- - -DESART$|$1-0-A-CODE_DOMAINE-CODE DOMAINE........-0-CODE DOMAINE........- - -DOMAIN$|$
              ";
                                  
              
              'Parameters
              Dim db2 As New Link2i
              Dim result As String
              Dim Options As New Link2i.Link2iOptions
              Dim sqlQuery As String = "SELECT NUMART,DESART,DOMAIN FROM newrmf.tarticle WHERE NUMART='2TS4F07800001A'"
              
              'Function call
              result = db2.GetDataDescription(Options, sqlQuery)
              
              'Returned results
              result = "NUMART;2TS4F07800001A
              DESART;YD.ZZN JUCK 185RC 46/51 33.47QQ
              DOMAIN;2
              ===============================================
              SELECT NUMART,DESART,DOMAIN FROM newrmf.tarticle WHERE NUMART='2TS4F07800001A'$§$NUMART$§$NUMART-A-NUMERO_ARTICLE$|$DESART-A-DESIGNATION$|$DOMAIN-A-CODE_DOMAINE$|$
              32-0-A-NUMERO_ARTICLE-NUMERO ARTICLE......-0-NUMERO ARTICLE......-NUMART-Y-NUMART$|$64-0-A-DESIGNATION-DESIGNATION.........-0-DESIGNATION.........- - -DESART$|$1-0-A-CODE_DOMAINE-CODE DOMAINE........-0-CODE DOMAINE........- - -DOMAIN$|$
              "
                                  

              GetRecordCount

              Number of records obtained by an SQL SELECT query

              Description

              Counts records in the result of an SQL SELECT query (simple/join)

              Parameters
              • Options Link2i.Link2iOptions
                Four connection options ***
              • sqlQuery string
                SQL SELECT query from which to count (simple/join)
              Returns
              • GetRecordCount() integer
                Number of records as Integer
              
              //Parameters
              Link2i db2 = new Link2i();
              int result;
              Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
              string sqlQuery = "select * from LIBTEST.TABLETEST";
              
              //Function call
              result = db2.GetRecordCount(Options, sqlQuery);
              
              //Returned results
              result = 129000;
                                  
              
              'Parameters
              Dim db2 As New Link2i
              Dim result As Integer
              Dim Options As New Link2i.Link2iOptions
              Dim sqlQuery As String = "select * from LIBTEST.TABLETEST"
              
              'Function call
              result = db2.GetRecordCount(Options, sqlQuery)
              
              'Returned results
              result = 129000
                                  

              Programs

              These functions allow you to run existing IBM i programs from .NET environments, perform joint development and run ILE modules. You can also retrieve, edit and recompile programs using Excel/text files.

              RunProgram

              Running an existing program on IBM i

              Description

              RunProgram executes a program on the targeted IBM i with no parameters.

              Parameters
              • Options Link2i.Link2iOptions
                Four connection options ***
              • library string
                Name of the IBM i library/database that contains the program
              • pgmName string
                Name of the IBM i program to launch
              Returns
                
                //Parameters
                Link2i db2 = new Link2i();
                Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                string library = "LIBTEST";
                string pgmName = "PGMTEST";
                
                //Function call
                result = db2.RunProgram(Options, library, pgmName);
                
                //Returned results
                
                                    
                
                'Parameters
                Dim db2 As New Link2i
                Dim Options As New Link2i.Link2iOptions
                Dim library As String = "LIBTEST"
                Dim pgmName As String = "PGMTEST"
                
                'Function call
                result = db2.RunProgram(Options, library, pgmName)
                
                'Returned results
                
                                    

                RunProgramParam

                Running an existing program on IBM i with input parameters

                Description

                RunProgramParam executes a program on the targeted IBM i with input parameters.

                Parameters
                • Options Link2i.Link2iOptions
                  Four connection options ***
                • library string
                  Name of the IBM i library/database that contains the program
                • pgmName string
                  Name of the IBM i program to launch
                • prmList string
                  List of parameters' values (input and output) as a list. More details about passing parameters here
                • prmLength string
                  List of parameters' sizes (input and output) as a list. More details about passing parameters here
                • delimiter string
                  Delimiter used in parameters lists
                Returns
                • ref prmList string
                
                //Parameters
                Link2i db2 = new Link2i();
                Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                string library = "LIBTEST";
                string pgmName = "PGMTEST";
                string prmList = String.Empty;
                string prmLength = "List of parameters' sizes (input and output) as a list. More details about passing parameters here : www.knowledge.aumerial.com : String (ByVal)";
                string delimiter = "Delimiter used in parameters lists: String (ByVal)";
                
                //Function call
                result = db2.RunProgramParam(Options, library, pgmName, ref prmList, prmLength, delimiter);
                
                //Returned results
                
                prmList = "List of parameters' values (input and output) as a list. More details about passing parameters here : www.knowledge.aumerial.com : String (ByRef)";
                                    
                
                'Parameters
                Dim db2 As New Link2i
                Dim Options As New Link2i.Link2iOptions
                Dim library As String = "LIBTEST"
                Dim pgmName As String = "PGMTEST"
                Dim prmList As String = "
                Dim prmLength As String = "List of parameters' sizes (input and output) as a list. More details about passing parameters here : www.knowledge.aumerial.com : String (ByVal)"
                Dim delimiter As String = "Delimiter used in parameters lists: String (ByVal)"
                
                'Function call
                result = db2.RunProgramParam(Options, library, pgmName, prmList, prmLength, delimiter)
                
                'Returned results
                
                prmList = "List of parameters' values (input and output) as a list. More details about passing parameters here : www.knowledge.aumerial.com : String (ByRef)"
                                    

                RunProgramParamReturn

                Running an existing program on IBM i with input and return parameters

                Description

                RunProgram executes a program on the targeted IBM i with input and return parameters.

                Parameters
                • Options Link2i.Link2iOptions
                  Four connection options ***
                • library string
                  Name of the IBM i library/database that contains the program
                • pgmName string
                  Name of the IBM i program to launch
                • prmList string
                  List of parameters' values (input and output) as a list. More details about passing parameters here
                • prmLength string
                  List of parameters' sizes (input and output) as a list. More details about passing parameters here
                • prmReturned string
                  Position in prmList of the parameters to be returned. More details about passing parameters here
                • delimiter string
                  Delimiter used in parameters lists
                Returns
                • ref prmList string
                
                //Parameters
                Link2i db2 = new Link2i();
                Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                string library = "LIBTEST";
                string pgmName = "PGMTEST";
                string prmList = String.Empty;
                string prmLength = "List of parameters' sizes (input and output) as a list. More details about passing parameters here : www.knowledge.aumerial.com : String (ByVal)";
                string prmReturned = "Position in prmList of the parameters to be returned. More details about passing parameters here : www.knowledge.aumerial.com : String (ByVal)";
                string delimiter = "Delimiter used in parameters lists: String (ByVal)";
                
                //Function call
                result = db2.RunProgramParamReturn(Options, library, pgmName, ref prmList, prmLength, prmReturned, delimiter);
                
                //Returned results
                
                prmList = "List of parameters' values (input and output) as a list. More details about passing parameters here : www.knowledge.aumerial.com : String (ByRef)";
                                    
                
                'Parameters
                Dim db2 As New Link2i
                Dim Options As New Link2i.Link2iOptions
                Dim library As String = "LIBTEST"
                Dim pgmName As String = "PGMTEST"
                Dim prmList As String = "
                Dim prmLength As String = "List of parameters' sizes (input and output) as a list. More details about passing parameters here : www.knowledge.aumerial.com : String (ByVal)"
                Dim prmReturned As String = "Position in prmList of the parameters to be returned. More details about passing parameters here : www.knowledge.aumerial.com : String (ByVal)"
                Dim delimiter As String = "Delimiter used in parameters lists: String (ByVal)"
                
                'Function call
                result = db2.RunProgramParamReturn(Options, library, pgmName, prmList, prmLength, prmReturned, delimiter)
                
                'Returned results
                
                prmList = "List of parameters' values (input and output) as a list. More details about passing parameters here : www.knowledge.aumerial.com : String (ByRef)"
                                    

                RunILEModule

                Running existing ILE module(s) on IBM i

                Description

                RunILEModule executes ILE module(s) on the targeted IBM i.

                Parameters
                • Options Link2i.Link2iOptions
                  Four connection options ***
                • library string
                  Name of the IBM i library/database that contains the temporary program to run ILE module(s)
                • pgmName string
                  Name of the IBM i temporary program
                • modules string
                  List of ILE module(s) to run, in Library/Module form (from 1 to 300 modules separated by a space)
                • currentLib string
                  Current library to run temporary program
                • additionalLib string
                  Additional libraries (separator '$,$') referenced to run temporary program
                Returns
                  
                  //Parameters
                  Link2i db2 = new Link2i();
                  Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                  string library = "LIBTEST";
                  string pgmName = "PGMTEST";
                  string modules = "MDLILE01 MDLILE02 MDLILE03 ";
                  string currentLib = "CURLIBTEST";
                  string additionalLib = "LIBTEST01$,$LIBTEST02";
                  
                  //Function call
                  result = db2.RunILEModule(Options, library, pgmName, modules, currentLib, additionalLib);
                  
                  //Returned results
                  
                                      
                  
                  'Parameters
                  Dim db2 As New Link2i
                  Dim Options As New Link2i.Link2iOptions
                  Dim library As String = "LIBTEST"
                  Dim pgmName As String = "PGMTEST"
                  Dim modules As String = "MDLILE01 MDLILE02 MDLILE03 "
                  Dim currentLib As String = "CURLIBTEST"
                  Dim additionalLib As String = "LIBTEST01$,$LIBTEST02"
                  
                  'Function call
                  result = db2.RunILEModule(Options, library, pgmName, modules, currentLib, additionalLib)
                  
                  'Returned results
                  
                                      

                  GetSourceXLSX

                  Exporting a source member in an Excel Edit structure

                  Description

                  GetSourceXLSX retrieves a source file from the targeted IBM i as an XLSX file.

                  Parameters
                  • Options Link2i.Link2iOptions
                    Four connection options ***
                  • base string
                    Database/library which members are to be listed
                  • srcFile string
                    Source file which members are to be listed
                  • member string
                    Name of the member to export as an xlsx file
                  • dirPath string
                    Directory path from where the source file has to be extracted on the Windows machine (uses '\' and must end by '\')
                  • outputFileName string
                    Name of the excel file without suffix
                  Returns
                  • GetSourceXLSX() string
                  
                  //Parameters
                  Link2i db2 = new Link2i();
                  string result;
                  Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                  string base = "LIBTEST";
                  string srcFile = "QDDSSRC";
                  string member = "FILE001";
                  string dirPath = "c:\xlsx\";
                  string outputFileName = "Filetest01";
                  
                  //Function call
                  result = db2.GetSourceXLSX(Options, base, srcFile, member, dirPath, outputFileName);
                  
                  //Returned results
                  result = "";
                                      
                  
                  'Parameters
                  Dim db2 As New Link2i
                  Dim result As String
                  Dim Options As New Link2i.Link2iOptions
                  Dim base As String = "LIBTEST"
                  Dim srcFile As String = "QDDSSRC"
                  Dim member As String = "FILE001"
                  Dim dirPath As String = "c:\xlsx\"
                  Dim outputFileName As String = "Filetest01"
                  
                  'Function call
                  result = db2.GetSourceXLSX(Options, base, srcFile, member, dirPath, outputFileName)
                  
                  'Returned results
                  result = ""
                                      

                  GetSourceTXT

                  Exporting a source member to a text file

                  Description

                  GetSourceTXT retrieves a source file from the targeted IBM i as a text file.

                  Parameters
                  • Options Link2i.Link2iOptions
                    Four connection options ***
                  • base string
                    Database/library which members are to be listed
                  • srcFile string
                    Source file which members are to be listed
                  • member string
                    Name of the member to export as a text file
                  • dirPath string
                    Directory path from where the source file has to be extracted on the Windows machine (uses '\' and must end by '\')
                  • outputFileName string
                    Name of the text file without suffix
                  Returns
                  • GetSourceTXT() string
                  
                  //Parameters
                  Link2i db2 = new Link2i();
                  string result;
                  Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                  string base = "LIBTEST";
                  string srcFile = "QDDSSRC";
                  string member = "FILE001";
                  string dirPath = "c:\txt\";
                  string outputFileName = "Filetest01";
                  
                  //Function call
                  result = db2.GetSourceTXT(Options, base, srcFile, member, dirPath, outputFileName);
                  
                  //Returned results
                  result = "";
                                      
                  
                  'Parameters
                  Dim db2 As New Link2i
                  Dim result As String
                  Dim Options As New Link2i.Link2iOptions
                  Dim base As String = "LIBTEST"
                  Dim srcFile As String = "QDDSSRC"
                  Dim member As String = "FILE001"
                  Dim dirPath As String = "c:\txt\"
                  Dim outputFileName As String = "Filetest01"
                  
                  'Function call
                  result = db2.GetSourceTXT(Options, base, srcFile, member, dirPath, outputFileName)
                  
                  'Returned results
                  result = ""
                                      

                  PostSource

                  Post a source member in the targeted IBM i

                  Description

                  Copies a source member from an Excel file to the specified database/library and source file in the targeted IBM i. The Excel workbook to be applied must be formatted as a result file of GetSourceXLSX.

                  Parameters
                  • Options Link2i.Link2iOptions
                    Four connection options ***
                  • base string
                    Library/database where to post the source member
                  • srcFile string
                    Source file where to post the source member
                  • member string
                    Name of the new member
                  • memberDescription string
                    Short description of the new member (max 72 characters)
                  • filePath string
                    Full path of the Xlsx file (with suffix 'xlsx') of the member to send
                  • srcType string
                    Link2i predefined source type 'TypeSource' (RPG, CLP, PF...)
                  Returns
                    
                    //Parameters
                    Link2i db2 = new Link2i();
                    Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                    string base = "LIBTEST";
                    string srcFile = "QDDSSRC";
                    string member = "FILE001";
                    string memberDescription = "Customers file";
                    string filePath = "c:\xlsx\source01.xlsx";
                    string srcType = "Link2i.TypeSource.PF";
                    
                    //Function call
                    result = db2.PostSource(Options, base, srcFile, member, memberDescription, filePath, srcType);
                    
                    //Returned results
                    
                                        
                    
                    'Parameters
                    Dim db2 As New Link2i
                    Dim Options As New Link2i.Link2iOptions
                    Dim base As String = "LIBTEST"
                    Dim srcFile As String = "QDDSSRC"
                    Dim member As String = "FILE001"
                    Dim memberDescription As String = "Customers file"
                    Dim filePath As String = "c:\xlsx\source01.xlsx"
                    Dim srcType As String = "Link2i.TypeSource.PF"
                    
                    'Function call
                    result = db2.PostSource(Options, base, srcFile, member, memberDescription, filePath, srcType)
                    
                    'Returned results
                    
                                        

                    CreateObject

                    Generating an executable object (compilation) on IBM i

                    Description

                    CreateObject compiles a member of the targeted IBM i into an executable object.

                    Parameters
                    • Options Link2i.Link2iOptions
                      Four connection options ***
                    • base string
                      Name of the database/library for which a source file member is compiled
                    • srcFile string
                      Name of the source file for which a source member is compiled
                    • member string
                      Name of the source member to compile
                    • srcType string
                      Link2i predefined source type 'TypeSource' (RPG, CLP, PF...)
                    • destBase string
                      Name of the destination database/library of the compiled object
                    • objName string
                      Name of the compiled object
                    Returns
                      
                      //Parameters
                      Link2i db2 = new Link2i();
                      Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                      string base = "LIBTEST";
                      string srcFile = "QDDSSRC";
                      string member = "FILE001";
                      string srcType = "Link2i.TypeSource.PF";
                      string destBase = "LIBOBJ";
                      string objName = "OBJ001";
                      
                      //Function call
                      result = db2.CreateObject(Options, base, srcFile, member, srcType, destBase, objName);
                      
                      //Returned results
                      
                                          
                      
                      'Parameters
                      Dim db2 As New Link2i
                      Dim Options As New Link2i.Link2iOptions
                      Dim base As String = "LIBTEST"
                      Dim srcFile As String = "QDDSSRC"
                      Dim member As String = "FILE001"
                      Dim srcType As String = "Link2i.TypeSource.PF"
                      Dim destBase As String = "LIBOBJ"
                      Dim objName As String = "OBJ001"
                      
                      'Function call
                      result = db2.CreateObject(Options, base, srcFile, member, srcType, destBase, objName)
                      
                      'Returned results
                      
                                          

                      RunStoredProcedure

                      Running an existing stored procedure on the targeted IBM i.

                      Description

                      RunStoredProcedure runs an existing stored procedure on the targeted IBM i.

                      Parameters
                      • Options Link2i.Link2iOptions
                        Four connection options ***
                      • library string
                        Name of the targeted IBM i library/database that contains the stored procedure
                      • prcName string
                        Name of the IBM i stored procedure to launch
                      • absoluteRec integer
                        Occurence number to start reading
                      • nbrRec integer
                        Number of records to read
                      • returnCursor string
                        Data value returned from the called stored procedure
                      • execCommit string
                        Value indicating whether a Commit is necessary or not
                      • xmlStr string
                        Raw data formatted in XML : String (ByRef)
                      • prmDataType string
                        List of predefined Link2i 'DB2ForiType' data types (_CHAR, _DECIMAL, _INTEGER...) matching the parameters values of prmDataList
                      • prmDataList string
                        List of parameters (input, output and inoutput) as a string list. For each output or inoutput list item, you must declare an empty value
                      • prmDirection string
                        Directions (values 'IN', 'OUT', 'INOUT') matching prmDataList parameters as a list of string
                      • prmReturned string
                        List of parameters values returned (OUT, INOUT) as a list of string. When calling the function, the list of string of the prmReturned parameter must have the same number of empty values as prmDataList
                      Returns
                      • RunStoredProcedure() System.Data.DataTable
                        Retrieves the result of a stored procedure as a System.Data.DataTable object and data as XML string passed by ref (if cursor request) and/ or a list of string containing the returned parameters values
                      • ref xmlStr string
                      • ref prmReturned string
                      
                      //Parameters
                      Link2i db2 = new Link2i();
                      System.Data.DataTable result = new System.Data.DataTable();
                      Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                      string library = "LIBTEST";
                      string prcName = "STPROC01";
                      int absoluteRec = 10;
                      int nbrRec = 120;
                      string returnCursor = "Y";
                      string execCommit = "Y";
                      string xmlStr = String.Empty;
                      string prmDataType = "{Link2i.DB2ForiType._Char, Link2i.DB2ForiType._Char, Link2i.DB2ForiType._Decimal, Link2i.DB2ForiType._Char}";
                      string prmDataList = "{"2TRAY31", "ZSZ NOD", "20", " "}";
                      string prmDirection = "{"IN", "IN", "IN", "OUT"}";
                      string prmReturned = String.Empty;
                      
                      //Function call
                      result = db2.RunStoredProcedure(Options, library, prcName, absoluteRec, nbrRec, returnCursor, execCommit, ref xmlStr, prmDataType, prmDataList, prmDirection, ref prmReturned);
                      
                      //Returned results
                      result; //
                      xmlStr = "<DataSet>...</DataSet>";
                      prmReturned = "{" ", " ", " ", " "}";
                                          
                      
                      'Parameters
                      Dim db2 As New Link2i
                      Dim result As New System.Data.DataTable
                      Dim Options As New Link2i.Link2iOptions
                      Dim library As String = "LIBTEST"
                      Dim prcName As String = "STPROC01"
                      Dim absoluteRec As Integer = 10
                      Dim nbrRec As Integer = 120
                      Dim returnCursor As String = "Y"
                      Dim execCommit As String = "Y"
                      Dim xmlStr As String = "
                      Dim prmDataType As String = "{Link2i.DB2ForiType._Char, Link2i.DB2ForiType._Char, Link2i.DB2ForiType._Decimal, Link2i.DB2ForiType._Char}"
                      Dim prmDataList As String = "{"2TRAY31", "ZSZ NOD", "20", " "}"
                      Dim prmDirection As String = "{"IN", "IN", "IN", "OUT"}"
                      Dim prmReturned As String = "
                      
                      'Function call
                      result = db2.RunStoredProcedure(Options, library, prcName, absoluteRec, nbrRec, returnCursor, execCommit, xmlStr, prmDataType, prmDataList, prmDirection, prmReturned)
                      
                      'Returned results
                      result '
                      xmlStr = "<DataSet>...</DataSet>"
                      prmReturned = "{" ", " ", " ", " "}"
                                          

                      CL commands from .Net

                      Run CL commands from .NET

                      RunCLCmd

                      Running an IBM i CL command

                      Description

                      Executes any CL command from .NET

                      Parameters
                      • Options Link2i.Link2iOptions
                        Four connection options ***
                      • cmd string
                        Command to execute
                      Returns
                        
                        //Parameters
                        Link2i db2 = new Link2i();
                        Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                        string cmd = ""CRTLIB LIB(LIBTEST) TEXT(LIBRARY TEST)"";
                        
                        //Function call
                        result = db2.RunCLCmd(Options, cmd);
                        
                        //Returned results
                        
                                            
                        
                        'Parameters
                        Dim db2 As New Link2i
                        Dim Options As New Link2i.Link2iOptions
                        Dim cmd As String = ""CRTLIB LIB(LIBTEST) TEXT(LIBRARY TEST)""
                        
                        'Function call
                        result = db2.RunCLCmd(Options, cmd)
                        
                        'Returned results
                        
                                            

                        Using Excel

                        Use Excel as an input-output peripheral to manually create, edit or delete data

                        XlsxUpdate

                        Creating an EXCEL document for updating data

                        Description

                        Exports an Excel workbook that can be used to manually edit records, and posted back for update to the targeted IBM i using XlsxApply function.

                        Parameters
                        • Options Link2i.Link2iOptions
                          Four connection options ***
                        • sqlQuery string
                          SQL SELECT query to execute
                        • orderByFields string
                          Complement to SQL ORDER BY statement. Fields separated by commas, can be followed by ASC or DESC (ex:'Field1 DESC, Field2, Field3 DESC')
                        • dirPath string
                          Path of the directory to export files into, uses '\' directories delimiter and ends by '\'
                        • outputFileName string
                          Name of the resulting xlsx file without suffix
                        Returns
                          
                          //Parameters
                          Link2i db2 = new Link2i();
                          Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                          string sqlQuery = "select ID, NAME, AGE from LIBTEST.TABLETEST WHERE age > 18";
                          string orderByFields = "ID, NAME DESC";
                          string dirPath = "c:\xlsx\";
                          string outputFileName = "FileXlsx";
                          
                          //Function call
                          result = db2.XlsxUpdate(Options, sqlQuery, orderByFields, dirPath, outputFileName);
                          
                          //Returned results
                          
                                              
                          
                          'Parameters
                          Dim db2 As New Link2i
                          Dim Options As New Link2i.Link2iOptions
                          Dim sqlQuery As String = "select ID, NAME, AGE from LIBTEST.TABLETEST WHERE age > 18"
                          Dim orderByFields As String = "ID, NAME DESC"
                          Dim dirPath As String = "c:\xlsx\"
                          Dim outputFileName As String = "FileXlsx"
                          
                          'Function call
                          result = db2.XlsxUpdate(Options, sqlQuery, orderByFields, dirPath, outputFileName)
                          
                          'Returned results
                          
                                              

                          XlsxCreate

                          Creating an EXCEL document for creating data

                          Description

                          Composes an Excel workbook based on an SQL SELECT query, that can be used to manually add records and posted back for adding, to the targeted IBM i using XlsxApply function.

                          Parameters
                          • Options Link2i.Link2iOptions
                            Four connection options ***
                          • sqlQuery string
                            SQL SELECT query to execute
                          • orderByFields string
                            Not necessary in creating mode. Complement to SQL ORDER BY statement. Fields separated by commas, can be followed by ASC or DESC (ex:'Field1 DESC, Field2, Field3 DESC')
                          • dirPath string
                            Path of the directory to export files into, uses '\' directories delimiter and ends by '\'
                          • outputFileName string
                            Name of the resulting xlsx file without suffix
                          Returns
                            
                            //Parameters
                            Link2i db2 = new Link2i();
                            Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                            string sqlQuery = "select * from LIBTEST.TABLETEST";
                            string orderByFields = "" "";
                            string dirPath = "c:\xlsx\";
                            string outputFileName = "FileXlsx";
                            
                            //Function call
                            result = db2.XlsxCreate(Options, sqlQuery, orderByFields, dirPath, outputFileName);
                            
                            //Returned results
                            
                                                
                            
                            'Parameters
                            Dim db2 As New Link2i
                            Dim Options As New Link2i.Link2iOptions
                            Dim sqlQuery As String = "select * from LIBTEST.TABLETEST"
                            Dim orderByFields As String = "" ""
                            Dim dirPath As String = "c:\xlsx\"
                            Dim outputFileName As String = "FileXlsx"
                            
                            'Function call
                            result = db2.XlsxCreate(Options, sqlQuery, orderByFields, dirPath, outputFileName)
                            
                            'Returned results
                            
                                                

                            XlsxCreateWithGeneric

                            Creating an EXCEL document for creating data with a generic

                            Description

                            Composes an Excel workbook based on an SQL SELECT query, with a sample line that can be used to manually add records and posted back for addition, to the targeted IBM i using XlsxApply function.

                            Parameters
                            • Options Link2i.Link2iOptions
                              Four connection options ***
                            • sqlQuery string
                              SQL SELECT query to execute
                            • orderByFields string
                              Not necessary in creating mode. Complement to SQL ORDER BY statement. Fields separated by commas, can be followed by ASC or DESC (ex:'Field1 DESC, Field2, Field3 DESC')
                            • dirPath string
                              Path of the directory to export files into, uses '\' directories delimiter and ends by '\'
                            • outputFileName string
                              Name of the resulting xlsx file without suffix
                            Returns
                              
                              //Parameters
                              Link2i db2 = new Link2i();
                              Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                              string sqlQuery = "select * from LIBTEST.TABLETEST";
                              string orderByFields = "" "";
                              string dirPath = "c:\xlsx\";
                              string outputFileName = "FileXlsx";
                              
                              //Function call
                              result = db2.XlsxCreateWithGeneric(Options, sqlQuery, orderByFields, dirPath, outputFileName);
                              
                              //Returned results
                              
                                                  
                              
                              'Parameters
                              Dim db2 As New Link2i
                              Dim Options As New Link2i.Link2iOptions
                              Dim sqlQuery As String = "select * from LIBTEST.TABLETEST"
                              Dim orderByFields As String = "" ""
                              Dim dirPath As String = "c:\xlsx\"
                              Dim outputFileName As String = "FileXlsx"
                              
                              'Function call
                              result = db2.XlsxCreateWithGeneric(Options, sqlQuery, orderByFields, dirPath, outputFileName)
                              
                              'Returned results
                              
                                                  

                              XlsxDelete

                              Creating an EXCEL document for deleting data

                              Description

                              Exports an Excel workbook that can be used to manually delete records and posted back for deletion to the targeted IBM i using XlsxApply function.

                              Parameters
                              • Options Link2i.Link2iOptions
                                Four connection options ***
                              • sqlQuery string
                                SQL SELECT query to execute
                              • orderByFields string
                                Complement to SQL ORDER BY statement. Fields separated by commas, can be followed by ASC or DESC (ex:'Field1 DESC, Field2, Field3 DESC')
                              • dirPath string
                                Path of the directory to export files into, uses '\' directories delimiter and ends by '\'
                              • outputFileName string
                                Name of the resulting xlsx file without suffix
                              Returns
                                
                                //Parameters
                                Link2i db2 = new Link2i();
                                Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                                string sqlQuery = "select ID, NAME, AGE from LIBTEST.TABLETEST WHERE age > 18";
                                string orderByFields = "ID, NAME DESC";
                                string dirPath = "c:\xlsx\";
                                string outputFileName = "FileXlsx";
                                
                                //Function call
                                result = db2.XlsxDelete(Options, sqlQuery, orderByFields, dirPath, outputFileName);
                                
                                //Returned results
                                
                                                    
                                
                                'Parameters
                                Dim db2 As New Link2i
                                Dim Options As New Link2i.Link2iOptions
                                Dim sqlQuery As String = "select ID, NAME, AGE from LIBTEST.TABLETEST WHERE age > 18"
                                Dim orderByFields As String = "ID, NAME DESC"
                                Dim dirPath As String = "c:\xlsx\"
                                Dim outputFileName As String = "FileXlsx"
                                
                                'Function call
                                result = db2.XlsxDelete(Options, sqlQuery, orderByFields, dirPath, outputFileName)
                                
                                'Returned results
                                
                                                    

                                XlsxApply

                                Applying an EXCEL document to DB2 for i

                                Description

                                Applies Excel workbooks generated by XlsxUpdate, XlsxCreate, XlsxCreateWithGeneric and XlsxDelete functions.

                                Parameters
                                • Options Link2i.Link2iOptions
                                  Four connection options ***
                                • resultFilePath string
                                  Full path of the file to apply, using '\' as directory delimiter
                                Returns
                                  
                                  //Parameters
                                  Link2i db2 = new Link2i();
                                  Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                                  string resultFilePath = "c:\xlsx\FileXlsx.xlsx";
                                  
                                  //Function call
                                  result = db2.XlsxApply(Options, resultFilePath);
                                  
                                  //Returned results
                                  
                                                      
                                  
                                  'Parameters
                                  Dim db2 As New Link2i
                                  Dim Options As New Link2i.Link2iOptions
                                  Dim resultFilePath As String = "c:\xlsx\FileXlsx.xlsx"
                                  
                                  'Function call
                                  result = db2.XlsxApply(Options, resultFilePath)
                                  
                                  'Returned results
                                  
                                                      

                                  Utility functions

                                  These functions provide you with an out-of-the-box user interface to work with your data. Display and edit data from an ASP.NET page as you would do on a 5250 screen. Go further and exploit XML data to build your own user interfaces to master your data.

                                  UtilityCLCmdGet

                                  Retrieving IBM i CL command in a System.Web.UI.WebControls.Panel

                                  Description

                                  retrieves a CL command builder in a System.Web.UI.WebControls.Panel, used to compose a prompt CL command with a 5250-like interface in an ASP.NET web page.

                                  Parameters
                                  • Options Link2i.Link2iOptions
                                    Four connection options ***
                                  • cmd string
                                    CL command to get a prompt from
                                  • promptPanel System.Web.UI.WebControls.Panel
                                    Mandatory panel used to display utility user interface
                                  Returns
                                  • ref cmd string
                                  • ref promptPanel System.Web.UI.WebControls.Panel
                                  
                                  //Parameters
                                  Link2i db2 = new Link2i();
                                  Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                                  string cmd = String.Empty;
                                  System.Web.UI.WebControls.Panel promptPanel = new System.Web.UI.WebControls.Panel();
                                  
                                  //Function call
                                  result = db2.UtilityCLCmdGet(Options, ref cmd, ref promptPanel);
                                  
                                  //Returned results
                                  
                                  cmd = "CPYF";
                                  promptPanel; //System.Web.UI.WebControls.Panel
                                                      
                                  
                                  'Parameters
                                  Dim db2 As New Link2i
                                  Dim Options As New Link2i.Link2iOptions
                                  Dim cmd As String = "
                                  Dim promptPanel As New System.Web.UI.WebControls.Panel
                                  
                                  'Function call
                                  result = db2.UtilityCLCmdGet(Options, cmd, promptPanel)
                                  
                                  'Returned results
                                  
                                  cmd = "CPYF"
                                  promptPanel 'System.Web.UI.WebControls.Panel
                                                      

                                  UtilityCLCmdGetXML

                                  Retrieving IBM i CL command in XML format

                                  Description

                                  retrieves a CL command builder in an XML string, used to compose a prompt CL command with a 5250-like interface in an ASP.NET web page.

                                  Parameters
                                  • Options Link2i.Link2iOptions
                                    Four connection options ***
                                  • cmd string
                                    CL command to get a prompt from
                                  Returns
                                  • UtilityCLCmdGetXML() string
                                    Data formatted as XML string
                                  • ref cmd string
                                  
                                  //Parameters
                                  Link2i db2 = new Link2i();
                                  string result;
                                  Link2i.Link2iOptions Options = new Link2i.Link2iOptions();
                                  string cmd = String.Empty;
                                  
                                  //Function call
                                  result = db2.UtilityCLCmdGetXML(Options, ref cmd);
                                  
                                  //Returned results
                                  result = " ";
                                  cmd = "CPYF";
                                                      
                                  
                                  'Parameters
                                  Dim db2 As New Link2i
                                  Dim result As String
                                  Dim Options As New Link2i.Link2iOptions
                                  Dim cmd As String = "
                                  
                                  'Function call
                                  result = db2.UtilityCLCmdGetXML(Options, cmd)
                                  
                                  'Returned results
                                  result = " "
                                  cmd = "CPYF"
                                                      

                                  UtilityCLCmdBuild

                                  ASP Panel variant Creating an IBM i command from a formatted prompt using a panel

                                  Description

                                  Generates a valid CL command ready to be executed using RunCLCmd function from a System.Web.Panel control populated using UtilityCLCmdGet function and edited by the user.

                                  Parameters
                                  • promptPanel System.Web.UI.WebControls.Panel
                                    Utility panel used to compose the command (populated using UtilityCLCmdGet)
                                  Returns
                                  • UtilityCLCmdBuild() string
                                    A CL Command as string
                                    Error message on failure as string
                                  
                                  //Parameters
                                  Link2i db2 = new Link2i();
                                  string result;
                                  System.Web.UI.WebControls.Panel promptPanel = new System.Web.UI.WebControls.Panel();
                                  
                                  //Function call
                                  result = db2.UtilityCLCmdBuild(promptPanel);
                                  
                                  //Returned results
                                  result = "CRTLIB LIB(LIBTEST) TEXT(LIBRARY TEST)";
                                                      
                                  
                                  'Parameters
                                  Dim db2 As New Link2i
                                  Dim result As String
                                  Dim promptPanel As New System.Web.UI.WebControls.Panel
                                  
                                  'Function call
                                  result = db2.UtilityCLCmdBuild(promptPanel)
                                  
                                  'Returned results
                                  result = "CRTLIB LIB(LIBTEST) TEXT(LIBRARY TEST)"
                                                      

                                  UtilityCLCmdBuild

                                  String variant Creating an IBM i command from a parameters list in a chars string

                                  Description

                                  Generates a valid CL command ready to be executed using RunCLCmd function from a parameters chars string got using the UtilityCLCmdGet function.

                                  Parameters
                                  • clParametersStr string
                                    List of parameters in a chars string used to compose the CL command
                                  Returns
                                  • UtilityCLCmdBuild() string
                                    A CL Command as string
                                    Error message on failure as string
                                  
                                  //Parameters
                                  Link2i db2 = new Link2i();
                                  string result;
                                  string clParametersStr = "CRTLIB| LIBTEST,*PROD,*LIBCRTAUT,1,*ASP,*SYSVAL,*SYSVAL,Test Library,|LIB,TYPE,AUT,ASP,ASPDEV,CRTAUT,CRTOBJAUD,TEXT,|-,-,-,-,-,-,-,-,|,*PROD,*LIBCRTAUT,1,*ASP,*SYSVAL,*SYSVAL,*BLANK,";
                                  
                                  //Function call
                                  result = db2.UtilityCLCmdBuild(clParametersStr);
                                  
                                  //Returned results
                                  result = "CRTLIB LIB(LIBTEST) TEXT(LIBRARY TEST)";
                                                      
                                  
                                  'Parameters
                                  Dim db2 As New Link2i
                                  Dim result As String
                                  Dim clParametersStr As String = "CRTLIB| LIBTEST,*PROD,*LIBCRTAUT,1,*ASP,*SYSVAL,*SYSVAL,Test Library,|LIB,TYPE,AUT,ASP,ASPDEV,CRTAUT,CRTOBJAUD,TEXT,|-,-,-,-,-,-,-,-,|,*PROD,*LIBCRTAUT,1,*ASP,*SYSVAL,*SYSVAL,*BLANK,"
                                  
                                  'Function call
                                  result = db2.UtilityCLCmdBuild(clParametersStr)
                                  
                                  'Returned results
                                  result = "CRTLIB LIB(LIBTEST) TEXT(LIBRARY TEST)"