|
Vijosh wrote: >Hi, > >I have come across the following problem while using the opcode TESTN. > >Prob: While testing a character field entry for Numeric, it so happens that >if all the contents of the field are numbers except the last one which may >be an alphabet, still TESTN shows it as numeric. TESTN is working as expected. Read about TESTN in the RPG Reference manual. > >Possible Reason : After doing some trials on this, I came to the conclusion >that, in the case of a negative number DB2 stores the negative sign in the >PF with a character at the end which indicates the sign. E.g.: },R,H...etc. >So if this alphabet figures in the earlier mentioned value given to TESTN >then it shows it as Numeric. For testing this you may add values -1...-9 >into a database and then do a DSPPFM. Read about zoned numeric data in the RPG Reference manual. > >Question: I wanted to know whether the reason for wrong result given by >TESTN is the same as the one I have mentioned above or is there something >else to it. For solving my problem I had to write certain extra lines of >code to avoid TESTN. Is there any solution which will avoid my extra lines >of code, and do it with one opcode? > You could use CHECK to check if all characters in a character field are digits. Cheers! Hans Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This is the RPG/400 Discussion Mailing List! To submit a new * * message, send your mail to "RPG400-L@midrange.com". To unsubscribe * * from this list send email to MAJORDOMO@midrange.com and specify * * 'unsubscribe RPG400-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-2025 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.