Try this:
dcl-ds REC extname('KO17FEXPRC');
________________________________
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> on behalf of john erps <jacobus.erps@xxxxxxxxx>
Sent: Thursday, October 11, 2018 7:25 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Problems using embedded SQL
Again... troubles with the dreaded "variable not usable"
I have the following **FREE format RPG :
**free
dcl-ctl option(*noshowcpy : *noexpdds : *srcstmt : *nodebugio);
dcl-ds REC extname(KO17FEXPRC);
end-ds;
dcl-s prcid packed(10:0);
exec sql
select max(PRCID17) into :prcid from KO17FEXPRC;
exec sql
declare sqlcur cursor for
select * from KO17FEXPRC
where EXCHID17 = 106 and INSTID17 = 4
and DATEFROM17 >= '2018-01-01' and DATEFROM17 <= '2018-09-30'
for read only;
exec sql
open sqlcur;
exec sql
fetch sqlcur into :REC;
dow (SQLCOD <> 100 and SQLCOD >= 0);
prcid += 1;
PRCID17 = prcid;
INSTID17 = 101;
insert into KO17FEXPRC values(:REC);
exec sql
fetch sqlcur into :REC;
enddo;
return;
The SQL compiler complains for the two fetch statements that REC is
undefined or unusable.
I get this error all of the time it's ot funny anymore.
Is this because it's **free RPG or .....???
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
[
https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com
CONFIDENTIALITY NOTICE
This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.
As an Amazon Associate we earn from qualifying purchases.