×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Here is an example for your second question.  You may be able to position to
a record using rs.absolute().  I have never tried it.  Remember that a
result set from a stored procedure is forward read only.

con = new Connection();
cs = new CallableStatement();
rs = new ResultSet();
cs = con.prepareCall(call mylib.pgm1 (?,?));
// set the input parms
cs.setString(1, getEnvironment()); // Environment
cs.setString(2, ordLine.toString()); // Array
// execute the stored procedure
rs = cs.executeQuery();
while (rs.next())
{
...some code here
}

rs.close();
cs.close();
con.close();

Regards,
Schadd Gray
Damon Technologies, Inc.
Stored Procedure Test Environment
www.damontech.com

----- Original Message ----- 
From: <meovino@xxxxxxxxxxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Wednesday, June 30, 2004 10:47 AM
Subject: Returning Result Sets from SQLRPGLE - positioning the cursor


> We're getting into using embedded SQL in RPG programs to return result
> sets to Net.Data macros.  It works great.  We've figured out how to return
> the entire result set, but how do we limit the result set to the first 'n'
> rows and then how do we get the result set to start at row 'n + 1' and
> return 'n' more rows?
>
> What we're looking to do is page through large result sets rather than
> display them all at once.  When using SQL in Net.Data, we used the
> START_ROW_NUM and RPT_MAX_ROWS variables to page through result sets.
>
> Here's what we're doing to return a result set:
>
> c/exec sql
> c+ declare C1 cursor for
> c+
> c+ select *
> c+ from filename
> c+ where fieldname = :value
> c+ order by fieldname
> c+
> c+ for fetch only
> c/end-exec
>
> c/exec sql
> c+ open C1
> c/end-exec
>
> c/exec sql
> c+ set result sets cursor C1
> c/end-exec
>
> Also, does anyone know if can we call an SQLRPGLE program that returns a
> result set from a Java servlet, so we can use JSP's to format and display
> the result set?
>
> Thanks!
>
> Mike E.
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
>


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-2026 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.