Validate dates before conversion, aka. ISDATE() equivalent
<p>DB2 version is 9.7.0.7</p>

<p>I have a flat file, and need to validate fully prior to insert into a  production table.  For analysis, I've parsed it into a table where all columns are <code>VARCHAR</code>.</p>

<p>One of the tasks is to validate dates.  I need to be able to locate the specific invalid dates, to report on the scope (frequency) and solution (reason).</p>

<p>I use <code>ISDATE()</code> in Sybase and SQL Server, which returns a 1 for a valid date, and a 0 for an invalid date.  In Teradata, I left join to the <code>SYS_CALENDAR</code> table in the system catalog. It's been about 15 years since I've last been in a DB2 environment, but I believe analogs to either do not exist.
In this DB2 environment my role is limited to QA, meaning I cannot create T-SQL procedures or UDFs.</p>

<p>This thread is clever and makes me think there may be some Common Table Expression logic that could be employed in a query:
<a href="https://stackoverflow.com/questions/7510509/isdate-equivalent-of-db2/37054902#37054902">ISDATE equivalent of DB2</a></p>

<p>That one falls short as a solution, however, because it only considers format - the presence of an invalid (but properly formatted) date like '2016-04-31' or '2016-02-30' will raise an error and the query will return no rows.  </p>

<p>I need to return all rows, identifying if each is valid or invalid (or just return the invalid rows for investigation, even) - so doing a <code>CAST</code> or <code>CONVERT</code>, or inserting into a formatted table in a test environment won't work.</p>

<p>Is there an analog to <code>ISDATE()</code>, <code>SYS_CALENDAR</code>, or another solution that gets to the same end product of a row-wise presentation of dates that can't be cast to <code>DATE</code>, prior to performing that conversion/insert?</p>