|
Eric, I sent you a very basic attachment off list. Below is the code, not as an attachment. Read it over and let me know if you have any questions. This program doesn't really do anything but it is important that you know what a cursor is. D HostVar S 200 D SortCol S 10A D fileds E DS extname(aaakey) C eval SortCol='loc' C exsr test C eval SortCol='comp' C exsr test C eval *inlr=*on ********************************************************* C test BegSr C eval HostVar='Select loc, comp, coname ' + C 'from aaakey ' + C 'order by ' + SortCol + C 'for fetch only' C/EXEC SQL C+ prepare stmt from :hostvar C/END-EXEC C/EXEC SQL C+ Declare C1 cursor for stmt C/END-EXEC C/EXEC SQL C+ Open C1 C/END-EXEC C/EXEC SQL C+ Fetch C1 into :loc, :comp, :coname C/END-EXEC C dow sqlcod=*zeros C* load subfile record C/EXEC SQL C+ Fetch C1 into :loc, :comp, :coname C/END-EXEC C enddo C/EXEC SQL C+ Close C1 C/END-EXEC C EndSr Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "Eric Wolf" <eric_a_wolf@hotmai To: midrange-l@midrange.com l.com> cc: Sent by: Fax to: midrange-l-admin@mi Subject: Using SQL within RPG drange.com 01/23/2002 01:44 PM Please respond to midrange-l Can anyone recommend a book or have some samples of using SQL calls within a RPG program? thanks... Eric A. Wolf _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l or email: MIDRANGE-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
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.