title: DB2 SQLCODE = -420, ERROR when comparing smallint fields with nulls
body: <p>I am trying to compare two smallint fields to look for differences.  One table is a pending change table that is read by a batch job at night that then updates the other table along with doing other activities.  The batch job has some issues and I'm researching the problems.  I want to find those values that are different and show what the pending table's value is when that occurs.</p>
  
  <p>The specific column(s) (CO_FT_FREQ_DAY) that are giving me trouble have nulls in the smallint field and I think that is the cause of my issues.  (or it could be a pending add so there is no matching value to compare to...)  As you can see I've tried to address the issue but it's still not working.<br>
   I tried ifnull before this, but got the same error.  I was hoping that this would resolve the issue.</p>
  
  <pre><code>SELECT  T342.clientID
         ,T342.TS_340
         ,case when (case when t342.CO_FT_FREQ_DAY is null then 0 else
                          t342.CO_FT_FREQ_DAY end) &lt;&gt;
                      (case when t340.CO_FT_FREQ_DAY is null then 0 else
                           t340.CO_FT_FREQ_DAY end)
               then T342.CO_FT_FREQ_DAY
               else 0
               end as CO_FT_FREQ_DAY
  FROM database.PendingChangeTable     T342
  left outer join database.CurrentTable T340
  on T340.ClientID = T342.ClientID
  and T340.TS_PK = T342.TS_340
  WHERE t342.clientID in (clientID list);
  </code></pre>
  
  <p>DSNT408I SQLCODE = -420, ERROR:  THE VALUE OF A STRING ARGUMENT WAS NOT<br>
           ACCEPTABLE TO THE DECFLOAT FUNCTION<br>
  DSNT418I SQLSTATE   = 22018 SQLSTATE RETURN CODE                         </p>