× 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 3/27/2024 8:26 AM, Daniel Gross wrote:
[...]
Another idea is using SQLs built in INTERPRET function?

SELECT INTERPRET(idfl03 AS DECIMAL(9, 8) FROM ...

This should also work.
I had not yet encountered the INTERPRET function, so I checked it out. As coded above, it failed:

[SQL0171] Argument 1 of function INTERPRET not valid.

I looked in the IBM i documentation and found this:

string-expression
An expression that returns a built-in binary string or character FOR BIT
DATA string that contains the internal IBM® i representation of
/data-type/. The length of /string-expression/ must follow the rules in
Table 1
<https://www.ibm.com/docs/en/i/7.4?topic=functions-interpret#rbafzscainterpret__rules>.

So I tried again as this:

SELECT INTERPRET(CAST(idfl03 AS CHAR(5) FOR BIT DATA) AS DECIMAL(9, 8) FROM...

That worked.

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.