On Monday, 25 June 2012 06:16:57 UTC-4, foxy.md wrote:
>
> what I'm trying to avoid is segmentation violation when millions records 
> are returned using EXECUTE "SELECT... WITH ..." RTNLIST ID.LIST in a routine
>


In many situations, you would be better off to avoid EXECUTE / SELECT / 
RTNLIST entirely, and simply code the conditions for valid record 
processing.  By using an EXECUTE statement, then processing the resulting 
list, you're reading every record twice, taking a hit on performance.  Why 
not read them just once by using the jBC SELECT statement?  Example:

OPEN 'MYFILE' TO MY.FL ELSE ...
SELECT MY.FL
LOOP 
   READNEXT ID ELSE EXIT
   READ REC FROM MY.FL, ID THEN
      IF REC<5> = MY.VALUE THEN
         DoSomething
      END
   END
REPEAT

While there is a performance benefit to this method, there is also a 
caveat.  The jBC SELECT statement does not scan the entire file to create a 
full list of item IDs before processing begins.  Instead, it just scans in 
the first few IDs of the file.  Once these IDs are taken from the list, a 
few more are scanned until the entire file has been processed.  A potential 
"problem" with this, depending on your processing logic, is that you could 
end up with records added to the file prior to when the SELECT was started.

--
Kevin Powick

-- 
-- 
IMPORTANT: T24/Globus posts are no longer accepted on this forum.

To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en



Reply via email to