Skip to main content

Are Host Arrays supported in OpenESQL ADO .NET managed code?

  • May 23, 2017
  • 1 reply
  • 0 views

We want to improve the speed at which one of our programs can INSERT rows into a table. Host Arrays sounds like the way to go, but the documentation (.NET Host Variables in Managed Code) specifies that .NET Host Variables must be declared at the Record (01) level? Can we do "01 EMP-EMPNO OCCURS 25 TIMES STRING." in a EXEC SQL BEGIN DECLARE SECTION?

1 reply

Chris Glazier
Forum|alt.badge.img+2
We want to improve the speed at which one of our programs can INSERT rows into a table. Host Arrays sounds like the way to go, but the documentation (.NET Host Variables in Managed Code) specifies that .NET Host Variables must be declared at the Record (01) level? Can we do "01 EMP-EMPNO OCCURS 25 TIMES STRING." in a EXEC SQL BEGIN DECLARE SECTION?

Yes this is supported. I just tested here with the following. The array must have a size and cannot just specify occurs any as this causes an error. BTW, EXEC SQL BEGIN DECLARE is not required when using OpenESQL.

 

 

       01 company-name-str  string occurs 5.
       01 company-contact-str string occurs 5.
       01 row-num pic s9(9) comp-5 value 5.

       procedure division.
           EXEC SQL 
              CONNECT TO 'SQLADO32WA' 
           END-EXEC 
          
           EXEC SQL 
              for :row-num
              SELECT 
                 A.CompanyName
                ,A.ContactName
              INTO 
                 :company-name-str
                ,:company-contact-str
              FROM dbo.Customers A
           END-EXEC 
           goback.