I have a COBOL+DB2 batch program having a SQL SELECT statement with 'WHERE' clause on Primary key.
I pass the primary key into host variable before EXEC SQL SELECT statement , after returning from DB2 the SQLCODE is 0 but the sleected column host variables are not getting populated.
You failure to follow up the request for the actual SQL you intend to execute may indicate that you have found the solution, but anyway:
A common mistake made by programmers is that they expect values for host variables used in the where statement to be updated with the actual value for a fetched row.
You should include the wanted column in the select into a host variable to get the actual value.