C++ Declaration for CLOB larger than 32K

GANESH GOSAVI

C++ Declaration for CLOB larger than 32K
You need to declare the the Host variable as follows:

Original Problem Statement:
=

// FileName : arysize.sqc
// Author : Ganesh Gosavi

#include <stdio.h>
#include <string.h>

EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN declare SECTION;
char ResumeData[65533];
EXEC SQL END declare SECTION;

EXEC SQL BEGIN DECLARE SECTION
char ResumeData[65533];
EXEC SQL END DECLARE SECTION

int main(void)
{

EXEC SQL select
RESUME /* CLOB datatype in the table*/
INTO
:ResumeData FROM
EMP_RESUME
WHERE
RESUME_FORMAT = 'ascii'; /* VARCHAR2(10 CHAR) */
return SUCCESS;

}

When u compile this file as follows:

C:\Ganesh\Work\chararysize>db2 prep ary.sqc bindfile

LINE MESSAGES FOR ary.sqc
------ ---------------------------------------------------------------
SQL0060W The "C" precompiler is in progress.
22 SQL0314N The host variable "ResumeData" is incorrectly
declared.
SQL0095N No bind file was created because of previous
errors.
SQL0091W Precompilation or binding was ended with "2"
errors and "0" warnings.

The above kind of declaration gives SQL0314N error while doing "db2 prep"
on the .sqC file. To remove this error, you need to declare the vars
(whose size u wanna > 32K i.e 32672) as follows:


Resolution :
=

EXEC SQL BEGIN DECLARE SECTION
SQL TYPE IS CLOB (65533) ResumeData;
EXEC SQL END DECLARE SECTION


This will resolve your issue of declaring the host var having size > 32K.

Thanks and Regards,
GANESH GOSAVI
IBM Pune, India

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm