|
Gauri, That's one way. However I still prefer moving the SQL into subprocedures: 1 - So I don't have to break in and out of /free in my mainline 2 - So I can use a single fetch statement 3 - The single fetch statement makes it less risky to use an ITER statement and not get stuck into an endless loop (been there, done that). If not OpenCursor(); return; EndIf; Dow FetchCursor(); // main line code ... EndDo; In fact, I like it so much I've even moved simple READs into subprocedures setll mykey myfile; Dow ReadFile(); // main line code ... EndDo; Now, if you want, you can still put a simple check to see if either the sqlstt (if you are using a fetch) or the %status(myfile) (if you are using a read) are other than the simple end-of-file and perform error processing. Then again, you can stick that error processing in the subprocedure. Or do both, if the business process is helped by it. Rob Berendt
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.