× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Greetings all,

 

I'm not sure if this is the correct place to post this, but please correct
me if its not.

 

I wrote a VBA proc to upload records from an Excel spreadsheet to the
iSeries. I realize I can use IBM's file upload addin for Excel, but chose
not to. When the code runs, it take a very long time. I looked at the job
running on the iSeries  and noticed it opening and closing the file I'm
uploading to for each row in the spreadsheet. A snipit of the code is
follows: 

 

Set cn_iSeries = CreateObject("ADODB.Connection")

cn_iSeries.Open "provider=IBMDA400;data source=S103LB4M;", "", ""

Set rs = CreateObject("ADODB.Recordset")

Set cmd = CreateObject("ADODB.Command")

Set cmd.ActiveConnection = cn_iSeries

  

Set currentcell = Worksheets(ActiveSheet.Name).Range("A3")

 

Do Until currentcell.Value = ""

  

  cmd.CommandText = "INSERT INTO library.file VALUES ("

  cmd.CommandText = cmd.CommandText & "'" & currentcell.Offset(0, 0).Value &
"'" & ","

  cmd.CommandText = cmd.CommandText & "'" & currentcell.Offset(0, 1).Value &
"'"

  cmd.CommandText = cmd.CommandText & ")"

  

  cmd.CommandType = adCmdText

  cmd.Execute

  

   Loop  

 

 

I was wondering if there is a better way performance wise to do this. It
would be nice if the iSeries wouldn't open and close the file for each row,
but I'm not sure if that can be controlled or not. 

 


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.