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



In summary, you need a good skeleton of a SQLRPGLE program that processes
a subfile, backwards and forwards.

And the other question is: Are you better off using multiple cursors (for
the different selection criteria) or using "prepared" statements? Dynamic
sql or not?

There are better 5250 programmers out there so I'll hope you get a good
template from them.

As far as the cursors go, study this:

Step 1: Build a rpg variable that has all this in it.
MySqlStmt =
Declare C1 cursor for
Select t1.col11, t1.name, t1.col13, t2.zip, t3.city
from table1 t1
join table2 t2
on t1.col12 = t2.itskey
join table3 t3
on t1.col13 = t3.itskey
where t1.name between ? and ?
and t2.zip between ? and ?
and t3.city between ? and ?
order by ...
Comment: The question marks are called "parameter markers". More on this
later...

Step 2: Prepare a sql statement from this variable
exec sql Prepare Stmt1 from :MySqlStmt;

Step 3: Declare the cursor from the prepared statement.
exec sql Execute Stmt1;

Step 4: Open the cursor. Pass in variables into the parameter markers.
If you only want a single value for "t2.col2a" then pass the same variable
into the left and the right of the and.
exec sql Open c1 using :FromName, :ToName, :FromZip, :ToZip, :FromCity,
:ToCity;

Then you do your fetches and whatnot.

Study also:
- Soundex http://preview.tinyurl.com/sqlsoundex
- like http://preview.tinyurl.com/sqllike


Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.