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



"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx> wrote on 04/19/2018 01:00:02
PM:
----- Message from Stephen Coyle <stephenfcoyle@xxxxxxxxx> on Wed,
18 Apr 2018 13:49:36 -0400 -----

To:

"RPG programming on the IBM i (AS/400 and iSeries)"
<RPG400-L@xxxxxxxxxxxx>

Subject:

SQLRPGLE Update Dynamic Filename using WHERE CURRENT OF

HI All,

Need some help with this as I cannot find an example.

I have a filename that is input as a parm.
I prepare the sql statement with the variable filename, then declare,
open,
fetch/update loop and close.
Now when I update the current record all samples I have seen are using a
hard coded filename.
I believe I could get around with a sql execute immediate but would like
to
stick with WHERE CURRENT OF.

Any help appreciated.
Here are the relevant bits....It's the 'Update @FileName' below that
throws
me off.

DCL-S SelectSQL Like(StdLTxtVar)
Inz('Select keyValues from &1 FOR UPDATE OF
TOKEN');

// Replace marker with file name
SelectSQL = %ScanRpl('&1' :@FileName :SelectSQL);

exec sql
Prepare S1 from :SelectSQL;
exec sql
declare C1 cursor for S1;
exec sql
open C1;
exec sql
fetch next from C1 into :KeyValues;

WrkToken = xmlTransaction(keyValues :Mode :@LoadName :groupID);

exec sql
Update @FileName
Set Token = :WrkToken
WHERE CURRENT OF C1;

Thanks in advance...
- Steve

An often overlooked, but simple and effective way is to execute an OVRDBF
on the file--either in a CL driving the RPG or calling QCMDEXC or QCAPCMD
within the RPG.

Michael Quigley
Computer Services
The Way International

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