From: MidRange

I am working on an application using jt400 jdbc to access a db on
the i5. The application moves backward and forward through a couple
of files (in lockstep) randomly, based on user input. What is the
best way to accomplish this? I can just create a statement and
result set with each iteration, but it seems there ought to be a way
to use a cursor or something to traverse the tables more
economically without opening and closing result sets constantly.
However, I cannot find anything that allows me to do that. I am
only an egg.;) Can someone enlighten me? Thanks!

Hi Rick! The toolbox support two distinct styles of file access. The first
is the standard SQL-oriented access of JDBC, which allows you to create a
cursor and then move through it, but repositioning randomly (especially
based on key) is not particularly easy. You can't, for example, create a
result set starting at a given key value and then position yourself
BACKWARDS one record (along the lines of a SETGT, READP).

The second technique is called Record Level Access, or RLA, and it basically
provides standard access to your files, by RRN for non-keyed files and by
key for keyed files. You can open a logical view and then position yourself
by key anywhere in the file exactly like a SETLL (well almost exactly; there
is a subtle difference on where the cursor gets positioned, but for most
purposes it works just the same).

I wrote a course comparing the two a while back, but in general it's pretty
straightforward. You can find documentation on the standard JDBC stuff just
about anywhere; it's pretty much industry standard. IBM has documentation
on and
for the RLA stuff.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by 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.