Page 1 of 1

Data present in the column still SQLCODE is 100

PostPosted: Mon Mar 07, 2016 7:50 pm
by kumarjitendra
Hi,

I have written a DB2 query to fetch a column from table depending on certain where clause. Query is returning the value present in the column but its setting SQL return code to true. I have coded my program in such a way that it abends if SQL code other 0 comes.

Please help on how to resolve this problem.

Thanks in advance.

Re: Data present in the column still SQLCODE is 100

PostPosted: Mon Mar 07, 2016 7:58 pm
by NicC
Show the relevant code. Note that a code of 100 is a successful return code - not an error.

Re: Data present in the column still SQLCODE is 100

PostPosted: Mon Mar 07, 2016 8:03 pm
by kumarjitendra
EXEC SQL                                          
SELECT                                            
     column_name                              
   INTO                                          
     :table.column_name                
   FROM                                          
     table A1                              
   WHERE                                          
     A1.date = :WS-currentdate AND            
     A1.loan_number = :table.column-name1 AND      
     A1.loan_code = :table.column-name2
END-EXEC    


Due to project restriction I can't share the actual code.

Re: Data present in the column still SQLCODE is 100

PostPosted: Mon Mar 07, 2016 10:54 pm
by prino
1) There is no SQLCODE "TRUE"

2) Did you zero the host-variable, or fill it with spaces, low or high values before executing the query, and check if you really got something back when the SQLSTATE = '02000'?

Re: Data present in the column still SQLCODE is 100

PostPosted: Tue Mar 08, 2016 2:07 am
by NicC
Due to project restriction I can't share the actual code.

In that case we cannot help you as it is, probably, the error checking that is wrong or maybe you do actually have a column that meets the criteria - the values of which you have not shown. And please use the code tags when posting code and/or data. The true alignment shows up when used.