IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
6968 Posts

Pinned topic DB2 Cursor returns SQL code +100 always

‏2009-12-11T10:13:35Z |
I am facing an issue while using the cursor in my COBOL-DB2 program. The program does the following.
1. Read a flat file
2. Chose a key from it
3. Fetch the DB2 table via cursor by using the key received from the Flat file (from step 1)
4. Some processing logic.
5. Write the details into a file.

The Issue : I am using a host variable in the "WHERE" clause of the Cursor Declaration. When I hardcode a value instead of the host variable, the SQL fetches data from the table perfectly, but when I move values to the host variable (before opening the cursor) and use the host variable to fetch the data, the SQL returns SQLCODE +100. I have initialized the host variables before I move the values into it. The host variable is Alphanumeric/Char.

Request your help in resolving this issue.