|
This is often the advice, but it seems easier to say than do.
I was just given a small program to write where, in the good 'ol
days, I'd have done an OPNQRYF followed by a client file read with
the RPG cycle and use the calculation specs beginning or end to
treat the client once only if it occurs multiple times in the file.
As I can no longer write OPNQRYF that complex without looking it up,
I plunged straight into the RPGSQLE solution :
Declare result set DS
Dynamically prepare a cursor
Declare cursor
Open cursor
Then logic to Fetch
Manage SQL errors after each operation.
The query was a select distinct on one file only using a date field
that was returned from a subprocedure.
The CLP that calls the RPG is now very clear, but the RPG is not as
simple as it would have been had I used the cycle. Also during
development, I had to add another field to the result set. As my
Fetch was in a subroutine and it was returning its results as
parameters, this meant changing the DS, the parameters, the
prototype, the CALLP and the cursor. With RLA, the extra field would
already have been available.
The non SQL solution would have been :
CALLP getDateParameter
OPNQRYF using dateParameter
CALL RPG using cycle to 'simulate' select distinct.
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.