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



As others have said, the error may not actually be in the area you posted. The pre-compiler gets easily confused on where actual errors are happening, so, comment out the "Fetch" statement entirely and see if the program will compile. Clean up all other errors, and then add the fetch back in. I suspect that another error is being reported as a problem with your datastructure.


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Alan Cassidy
Sent: Wednesday, May 5, 2021 4:52 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Embedded SQL compile error

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.


Ladies and Gentlemen, :)

I have been struggling with an embedded SQLRPGLE compile message.

SQL5011 30 22 Position 37 Host structure array FBH not defined or not usable. Reason: The host variable is not defined or is not a valid structure. A valid host structure must have at least one valid member.

This is the FETCH statement:

*exec sql Fetch next from CK for :Rows_to_fetch rows into :FBH ;*

This is the structure I'm reading into:

* dcl-ds FBH qualified dim(1000) ;
ot packed(3:0);
pro packed(7:0);
Tnum packed(5:0);
bba packed(1:0) ;
aba packed(1:0) ;
bscd char(7);
ascd char(7);
bymd Zoned(8:0);
aymd Zoned(8:0);
btime Zoned(6:0);
atime Zoned(6:0);
END-DS;
*

I even took out the DIM and listed out each field for the INTO: Into :OT, :PRO, :TNUM, etc. When I did that it gave me an error that ==> _Variable OT not defined or not usable. No declaration exists, is not within the scope, or the variable does not have an equivalent SQL type._ (I tried all packed, too). AND I tried doing the FETCH one row at a time (without the for :X rows) and got the not-defined error.

Can I get a witness??



--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

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.