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.