× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 14-May-2015 10:42 -0500, John McKee wrote:
A field on a file on the remote 520 is defined as numeric 8 0.
Supposed to have date in form of CCYYMMDD. I ran a query on the
field. Lots of bad values. I was hoping to see what might be in the
field. Never worked with CAST in SQL. Never needed to before.

When I try this:

select cast(xxxxxx as char(20) from xxxxxx. I get either some numeric
value (usually a single 0) or the '+' sign with it repeated 20
times.

An IBM query on the field showed the values as different - at least
when sorted and grouped, each group had one record.

I am not sure, yet, what value should be forced into the field to
clean up the data.

How do I add a where to the above select to only locate non-numeric
values?


They are all numeric value, according to the data type :-) When those value stored as a numeric type can not be cast to a character value, the internal representation of the numeric value is invalid; still, the system maintains them as /numeric/ even if unable to present them otherwise. Sorting and selection for which a decision about the inclusion or omission of the row [without other predicates precluding them from the result set] should result in the termination of the query; any other result is Incorrect Output.

See the following for an example of how to find the rows with invalid Zoned decimal data in the column; the query shown includes the Hex version of the data to reveal what data is there instead of the proper Zoned BCD (Binary Coded Decimal) data:
<http://archive.midrange.com/midrange-l/200907/msg00517.html>

I suppose the next question might be what of those numeric values are not proper /date/ representations. I have posted examples of that too... and could look one up if asked.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.