• Subject: Re: SQL Cursor Questions
  • From: "David Morris" <dmorris@xxxxxxxxxxxxx>
  • Date: Fri, 19 Nov 1999 08:48:36 -0700

NC,

I have tried various techniques to provide this functionality.  On a large 
file, 
(over about 5000 records) two cursors seems to work best.  I open the forward 
cursor first and the prior cursor if necessary.  On a reposition I close the 
cursors and start over.  On a smaller file a single cursor with a scan works 
pretty well.  The open(s) and scan are pretty easy to encapsulate in an SQL 
sub-procedure.  I can point you to some examples if you are interested.

David Morris

>>> ncsmith@gate.net 11/18/99 08:37PM >>>

-----Original Message-----
From: Buck Calabro <mcalabro@commsoft.net>
To: MIDRANGE-L@midrange.com <MIDRANGE-L@midrange.com>
Date: Thursday, November 18, 1999 11:35 AM
Subject: RE: SQL Cursor Questions


In other words, I want to do a SETLL with a key, and then
>>READ or READP without a key.  Is there any way to do this? (besides using
>>RPG, of course ;-)
>
>Got me stumped.  The primary use of WHERE is not to position the cursor;
>it's to subset records.  What's the business problem?  It's early and I
>can't figure out why I'd want to position to customers who's names begin
>with "J" and then read the K's and L's.  Why wouldn't I do a re-position
>with another WHERE when I want to look for "KING"?  I come from a "machine
>is too darned small for the workload" shop and am stuck with the idea that
>unnecessary I/O is a Bad Thing.

I tend to agree with you but our users like to "get close" and then "look
around".  Most of our current workwiths (implemented with RPG I/O)
reposition the subfile with a key and then allow rolling in either direction
from that point.  I'm trying to retain the same functionality (in SQL) as
they now have with Setll (with a key) and Read or Reade.  They don't really
want to change the functionality of the programs, just replace the I/O's
with a multi-record fetch.  If I Fetch Previous with the same cursor that
was declared with a Where clause, I always hit beginning of file, of course.


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.