Does the source member exist?
Try to generate the output member before running the GENERATE_SQL Stored
Procedure
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization ? Education ? Consulting on IBM i
Database and Software Architect
IBM Champion since 2020
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
"Train people well enough so they can leave, treat them well enough so they
don't want to. " (Richard Branson)
"Learning is experience ? everything else is only information!" (Albert
Einstein)
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of David
Gibbs via MIDRANGE-L
Sent: Friday, 23 January 2026 20:37
To: midrange-l@xxxxxxxxxxxxxxxxxx
Cc: David Gibbs <david@xxxxxxxxxxxx>
Subject: GENERATE_SQL problem
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.
As an Amazon Associate we earn from qualifying purchases.