× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I do this in RPG now.

I have a subroutine that builds the SQLString, PREPARE, DECLARE, and OPEN
CURSOR.  Then I have a subroutine that does a FETCH NEXT while there is a
"next".

C                       exsr    SQLPrepare
C                       dou     eof = *on
C                       exsr    SQLFetchN
C       CUSTNO  dsply
C                       enddo
C*--
C       SQLPrepare      begsr
C                       eval    SQLString = 'SELECT * FROM LIB/FILE WHERE 
CUSTNO=' + CustNo
C/exec sql
C+ PREPARE @SELECT FROM :@select1
C/end-exec
C
C/exec sql
C+ DECLARE @CURSOR DYNAMIC SCROLL CURSOR FOR @SELECT
C/end-exec
C
C/exec sql
C+ open @cursor
C/end-exec
C                 endsr
C*---
C    SQLFetchN    begsr
C                 eval      EoF = *off
C/exec sql
C+ FETCH NEXT FROM @CURSOR INTO :hostDS
C/end-exec
C                 if        SqlCod = 100
C                 eval      EoF = *on
C                 endif
C                 endsr

Phil

> -----Original Message-----
> From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]On
> Behalf Of Bartell, Aaron L. (TC)
> Sent: Thursday, September 06, 2001 10:11 AM
> To: 'rpg400-l@midrange.com'
> Subject: RE: Free format vs SQL
>
>
> I really like how Java does this.
>
> SQLString = 'SELECT * FROM LIB/FILE WHERE CUSTNO=' + CustNo
>
> Statement stmt = con.createStatement(); // create the statement on the 400
> ResultSet rs = stmt.executeQuery(sqlString); // execute the
> statement on the
> 400
>
>          while (rs.next()) // process result set
>          {
>            System.out.println(rs.getInt("CUSTNO"));
>          }
> So in the new free format RPG you cannot have the SQL free format?
>
> You know there is a lot that RPG could learn from Java.  And in the same
> breath vice versa:-)
>
> Aaron Bartell
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.