I hadn't caught the case difference. Certainly could be the problem.

I'd be curious what the errno return code was.

Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power




-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Mark Waterbury via MIDRANGE-L
Sent: Saturday, January 24, 2026 4:55 PM
To: David Gibbs via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Mark Waterbury <mark.s.waterbury@xxxxxxxxxxxxx>
Subject: Re: GENERATE_SQL problem

David,
Since you are coding this in ILE RPG IV anyway, why not just call the QSQGNSQL API directly (since that is what ultimately gets called by the GENERATE_SQL procedure anyway).
All the best,
Mark S. Waterbury
On Friday, January 23, 2026 at 02:37:12 PM EST, David Gibbs via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx> wrote:

Folks:

I'm trying to use the GENERATE_SQL procedure to retrieve the DDL for SQL
objects within an RPG service program.

The object definitely exists, as I'm querying SYSFILES to find the object
type.

When I invoke the GENERATE_SQL procedure, the following shows up in the
joblog (I'm debugging the program)...

Cursor GENSQL opened.
Row not found for GENSQL.
ODP not deleted.
Cursor GENSQL was closed.
Procedure or user-defined function GENERATE_SQL in *N returned a warning
SQLSTATE.

The details of the error are:
SQL0462
Message . . . . : Procedure or user-defined function GENERATE_SQL in *N
returned a warning SQLSTATE.

Cause . . . . . : An SQLSTATE of the form 01xxx was returned by the
procedure or user-defined function GENERATE_SQL in *N (with specific name
*N), along with message text NO OBJECTS FOUND.

The service program has authority to the table I'm trying to generate DDL
for.

Here's how the procedure is being invoked from the RPG...

CALL GENERATE_SQL(
DATABASE_OBJECT_NAME => :object,
DATABASE_OBJECT_LIBRARY_NAME => :library,
DATABASE_OBJECT_TYPE => :objectType,
DATABASE_SOURCE_FILE_NAME => :sourceFile,
DATABASE_SOURCE_FILE_LIBRARY_NAME => :sourceLib,
DATABASE_SOURCE_FILE_MEMBER => :sourceMbr,
REPLACE_OPTION => 1,
STATEMENT_FORMATTING_OPTION => 0,
HEADER_OPTION => 0,
PRIVILEGES_OPTION => 0,
CCSID_OPTION => 0;

The source PF & member is being created using a sql qcmdexc procedure call,
and the joblog shows it is either created or already exists.

Any ideas what might be causing the "NO OBJECTS FOUND" error?

Thanks!

david
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.


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.