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



The UPDATE should reference the table you want to update.

For example, here's my RDi snippet for updating a cursor:
EXEC SQL
update ${Library}/${File}
set COLUMN = :VARIABLE
where current of ${Cursor};

(Where ${} and " COLUMN = :VARIABLE" are placeholders to be filled in when inserting the snippet.)



-----Original Message-----
From: Stephen Coyle [mailto:stephenfcoyle@xxxxxxxxx]
Sent: Wednesday, April 18, 2018 12:50 PM
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


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.