Skip to main content

Cannot compile a DB2 program using dynamic SQL with DB2 ECM.

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

This is the error:

COBDB0103S WS-SQL-SELECT does not have a suitable definition to be used as a host variable.   

The PREPARE statement is causing the error:

                EXEC SQL

                    PREPARE WS_DECLARE FROM :WS-SQL-SELECT

                END-EXEC.

where the host variable is declared as:

01 WS-SQL-SELECT     PIC X(300).

Resolution:

The host variable needs to be declared as a variable character string using 49 levels.

For example declare the host variable as follows:

01 WS-SQL-SELECT.

     49 WS-SQL-SELECT-LEN        PIC S9(4) COMP-5.

     49 WS-SQL-SELECT-DATA     PIC X(300).

Old KB# 4415

#MainframeExpressandMFE
#MFDS
#COBOL
#EnterpriseDeveloper
#Enterprise
#netexpress