|
Hi Amir It depends on exactly what you want to try and achieve. If you want to position the cursor back to the very first record you positioned to originally then you can do it using scrollable cursors: C/Exec SQL C+ Declare C1 Scroll Cursor C+ For Select field1,field2 C+ From Filename C/End-Exec Open and use the cursor as normal, and then when you want to position back to the first record you can use C/Exec SQL C+ Fetch First C+ From C1 C+ Into :xfield1, :xfield2 C/End-Exec If you only want to position to the first record without reading the data then use: C/Exec SQL C+ Fetch Before C+ From C1 C/End-Exec You can reposition scrollable cusors using any of the following keywords: Next On the next row after the current row Prior On the row before the current row First On the first row Last On the last row Before Before the first row After After the last row Current On the current row (no change in position) Relative n n < -1 positions to nth row before current n = -1 same as Prior keyword n = 0 same as Current keyword n = 1 same as Next keyword n > 1 positions to nth row after current If you're hoping to be able to reposition to anywhere in the file then you will either have to close and re-open the cursor passing in the keys, or maintain a relative record number for the cursor so that you can use the Relative keyword to position backwards as far as you need to go. Hope this helps a little Best regards Jonathan www.astradyne-uk.com
As an Amazon Associate we earn from qualifying purchases.
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.