IBM Support

Message SQL0516 Prepared Statement Not Found When Using Extended Dynamic Support

Troubleshooting


Problem

A message SQL0516 might be returned in place of prior, more meaningful error. The job log will have all of the messages.

Resolving The Problem

Database host server clients such as ODBC and JDBC might report message SQL0516 - Prepared Statement not found error. The SQL0516 error usually relates to an internal error or APAR condition. However, when extended dynamic support is enabled, other errors might be reported as SQL0516. One example is: File not found (SQL0204).

When using extended dynamic support, an error such as SQL0204 causes a SQL0516. The database host server can only return the last error message (and SQLSTATE) to the client. That causes the client to report a prepared statement not found error rather than a more meaningful <file> in <lib> type *FILE not found error. The job log can be used to identify the source of the error.

For example

SQL0204 Information 30 10/01/02 14:49:42 QSQRUN1 QSYS *STMT QSQRUN1 QSYS *STMT
From module . . . . . . . . : QSQPREP
From procedure . . . . . . : CLEANUP
Statement . . . . . . . . . : 8386
To module . . . . . . . . . : QSQPREP
To procedure . . . . . . . : CLEANUP
Statement . . . . . . . . . : 8386
Message . . . . : F in B type *FILE not found.
Cause . . . . . : F in B type *FILE was not found. If this is
an ALTER TABLE statement and the type is *N, a constraint was not found. If
this is not an ALTER TABLE statement and the type is *N, a function,
procedure, or trigger was not found. Recovery . . . : Change the name and
try the request again. If the object is a node group, ensure that the IBM® DB2®
Multisystem product is installed on your system and create a nodegroup with
the CRTNODGRP CL command.
CPF9898 Information 40 10/01/02 14:49:43 QSQRUN1 QSYS *STMT QZDASQL QSYS *STMT
From module . . . . . . . . : QSQDESC
From procedure . . . . . . : SQL_Describe
Statement . . . . . . . . . : 8029
To module . . . . . . . . . : QZDASQL
To procedure . . . . . . . : GETSQLDA
Statement . . . . . . . . . : 23753
Message . . . . : STATEMENT NAME NOT FOUND :QZ84EF17688625D888 .
Cause . . . . . : This message is used by application programs as a general
escape message.
SQL0516 Diagnostic 30 10/01/02 14:49:43 QSQRUN1 QSYS *STMT QSQRUN1 QSYS *STMT
From module . . . . . . . . : QSQDESC
From procedure . . . . . . : CLEANUP
Statement . . . . . . . . . : 17670
To module . . . . . . . . . : QSQDESC
To procedure . . . . . . . : CLEANUP
Statement . . . . . . . . . : 17670
Message . . . . : Prepared statement QZ84EF17688625D888 not found.
Cause . . . . . : QZ84EF17688625D888 is not a valid prepared statement. The
statement has one of the following conditions: -- The statement has never
been prepared. -- The statement was prepared in another program or another
call of this program and the program was created with CLOSQLCSR(*ENDPGM). --
The statement was prepared in another module or another call of this module
and the module was created with CLOSQLCSR(*ENDMOD). -- The statement was
prepared in another call of this program and programs which have run SQL
statements have ended and the program was created with CLOSQLCSR(*ENDSQL).
-- The statement was prepared in another call of this module and the
activation group ended between calls. The module was created with
CLOSQLCSR(*ENDACTGRP). -- A COMMIT or ROLLBACK statement has destroyed all
the prepared statements. Recovery . . . : Do one of the following and
precompile again: -- Make certain that *N has been prepared in the same
program or module call prior to using the DESCRIBE statement or specify
either CLOSQLCSR(*ENDSQL), CLOSQLCSR(*ENDJOB), or CLOSQLCSR(*ENDACTGRP) when
precompiling the application. -- If the statement was deleted by a COMMIT or
ROLLBACK, specify HOLD on the COMMIT or ROLLBACK statement to preserve any
open cursors, prepared statements, and locks on tables.

[{"Product":{"code":"SWG60","label":"IBM i"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Host Servers","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Historical Number

28463605

Document Information

Modified date:
23 December 2019

UID

nas8N1016781