|
In message <33feab69.10974121@mail.ivic.qc.ca>, From ericm@ivic.qc.ca (Eric Mayrand), the following was written: > I want to test if an alphanumeric string is numeric or not. Do you > have some hints or tips to do this? Eric, As several others have implied, there is a TESTN op code. Testing for digits will not necessarily return the correct result when working with signed data, and the format of the data will have an impact also, so the "correct" solution is ... it depends on the data. If you're expecting only positive integer data, any of the methods that have been suggested will work. If not, be aware that the "." "," "+" and "-" characters are not considered to be valid in a numeric field on the AS/400, and the last nibble will contain a hexidecimal F if positive or D if negative. Even other IBM systems are not always consistent with this. Locale differences may also play a part. In some parts of the world, the "." and "," characters may be used differently than what you are accustomed to. ASCII systems that I've used have usually wanted a leading sign character and embedded decimal. You need to examine a comprehensive sample of data in the source and destination formats in order to make a decision. Pete -- - Pete Hall peteh@earth.inwave.com http://www.inwave.com/~peteh/ +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to "MIDRANGE-L@midrange.com". | To unsubscribe from this list send email to MAJORDOMO@midrange.com | and specify 'unsubscribe MIDRANGE-L' in the body of your message. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
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.