|
Kevin,
I tried your suggestion but now the compiler output is a complete mess.
It inserts all the SQL ^%$ before the dcl-ctl, doesn't recognize following
statements.
When i remove the dcl-ctl it compiles...
Thanks for your help!
On Thu, Oct 11, 2018 at 2:39 PM Kevin Bucknum <Kevin@xxxxxxxxxxxxxxxxxxx>
wrote:
Try this:Bucknum
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
Senior Programmer Analysthas
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
been fulfilled. If you are not the intended recipient, or the employeeof
agent responsible to deliver it to the intended recipient, you are herebyyou
notified that any disclosure, copying, distribution or action taken in
reliance on the contents of these documents is STRICTLY PROHIBITED. If
have received this email in error, please notify the sender immediatelyto
arrange for return or destruction of these documents.--
--
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
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
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.