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

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].