On 02-Sep-2016 15:23 -0600, Stone, Joel wrote:
<<SNIP>>
(Hopefully there is a better method than using an alpha screen
field and scraping it, scanning for a minus sign).


No need to scan. Just convert the string to numeric and monitor for a failure; that conversion, e.g. using the RPG %dec() conversion BIF expects a negative sign as prefix [as most other HLL string-to-numeric conversion built-in operations], but also allows for a minus sign as suffix instead, and prohibits any separators other than the decimal separator [as do most other HLL string-to-numeric conversion built-in operations].

Such a conversion also would avoid the possibility of the msg CPF5208 "Use of decimals not correct or too many numbers entered." that can occur from the WS display [file] manager; be sure to review whether the conversion that is used would effect rounding or truncating, and revise the effect as appropriate for the application. As I recall, the ILE RPG %dec() truncates.


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.