×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




The likely cause of the error is the lack of quotes around the file name in the extname.

With the advent of free-form declarations a number keywords such as this now allow the use (among other things) of named constants. So in a case like this the precompiled will be attempting to find a constant named KO17FEXPRC - there may be a message buried somewhere to that effect - and as a result the DS is never generated. Add the quotes and it will be able to find the definition.

Had this been a straight RPG compile the problem would have been a bit more obvious.

I don't know what release you are on or what PTF level etc. but you should also check if the SQL PTFs required for full **Free support are present.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Oct 11, 2018, at 11:24 AM, Justin Taylor <JUSTIN@xxxxxxxxxxxxx> wrote:

Have you tried compiling with parameter RPGPPOPT(*LVL2)? That often helps with that compiler error.

HTH



-----Original Message-----
From: john erps [mailto:jacobus.erps@xxxxxxxxx]
Sent: Thursday, October 11, 2018 7:25 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
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


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