× 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.




First thing to do is to pull out the SQL and run separately. How long
does it take to run?

<snip>
Would a named activation group positively affect performance in
this case?
</snip>

Always run ILE programs in a named activation group.

<snip>
Is there a way to reset the cursor without executing the declare
repeatedly
</snip>

If you issue the declare once and do an open and close each time, it
will reuse the Open Data Path(ODP). Actually, if you look at the
compiled code you will see that the declare is just a comment. There is
no executable code. 

Based on your SQL, you should be reusing the ODP 

Last thing. If you are reading in a lot of records, the best way to
increase the performance is to read in many records into an array. 

The best way to do this is to create a user space and load the records
directly to the user space. Then read the user space in a loop. 

I don't know your field sizes so I am guessing. Partial code. Just the
flavor. 

D dsRecord...
D                   s               Qualified
D                                   Based(ptrRecord)
D                                   Occurs(32766)
D  IORD#                     7a
D  IITEM                    15a
D  IQORD                     7p 2
D  IQSHP                     7P 2
D  SLDATE                    8s 0
 /Free

  ptrRecord = MakeUserSpace();

 /Exec Sql
  Fetch From C1 For 32766 Rows Into :dsRecord  
 /End-Exec

  w_RowCount = SQLERRD(3);

  For x = 1 to w_RowCount;
    %Occur(dsRecord) = x;
    // process record
  EndFor; 


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.