× 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.



I believe digits converts numeric values to alpha.....however  

This is from Ted Holt on Midrange Server:


I think SQL is a good way to go. Query/400 can read SQL views in the same
way it reads logical files. 

The following SQL command creates a view that defines the alpha field amount
as a nine-digit packed-decimal field with two decimal positions: 

create view myview as 
    select key, dec(amount,9,2) as amt from mydata

The following SQL commands convert alpha fields to numeric values: 

select real(amount) from mydata
select double(amount) from mydata 
select int(month) from mydata    
select cast (amount as double) from mydata

Not only is this good for Query, you could use SQL statements like these in
RPG programs.  

-- Ted 

Alex 

It's been a long time, but look for the "digits" function in Query.

Al

Al Barsa, Jr.
Barsa Consulting Group, LLC


Users want to convert an alpha field (containing all numeric characters) to
a numeric field so they can do arithmetic operations.

Is there any way to do this in Query/400?

Any creative ideas how to do this?

Maybe using some of the date functions?




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.