|
You are right, the alpha character represents the sign, but keep in mind that it also represents the last digit of the numeric field. If you do a work around the last character and reject it, it may actually be a negative numeric. (each character represents a digit and the neg. sign) I guess this is the reason TESTN works this way, the assumption being if the rest of the field is numeric, and the last character is one of these alpha characters, its a negative number. (because this is the way it's stored.) , Rick -----Original Message----- From: Vijosh A <VijoshA@alfuttaim.co.ae> To: 'Forum RPG' <RPG400-L@midrange.com> Date: Wednesday, April 28, 1999 4:05 AM Subject: Bug in opcode TESTN!!! >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. > >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. .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. > >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? > >Thanks & Regards >Vijosh >* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * >* 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 * >* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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.