Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Cobol > Re: Numeric com...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 13 Topic 4046 of 4195
Post > Topic >>

Re: Numeric comparison

by "HeyBub" <heybub@[EMAIL PROTECTED] > Mar 9, 2008 at 07:03 PM

jeff wrote:
> I am having an issue comparing numeric fields and it seems it should
> be easy. The field is Telephone it is deifines in input as pic x(12).
> it can include dashes.
> The first thing I do is check to see if there are dashes. If so I
> strip out the dashes and move the phone number field to a WS-telephone
> pic 9(10). then it goes thru a edit-input-field that is used in many
> programs we have. The routine makes sure there isn't any alphanumeric
> characters. After it goes thru that routine  It moves a pic 9(12)
> field to ws-input-tele-n field (pic 9(12)).  So it would be something
> like 007705051234. I need to make sure that it is either between
> 1000000 and 9999999 or 1000000000 and 9999999999. Any ideas on a
> better way to accomplish this?

Your attack to strip out all the non-essential stuff then put dashes or 
whatever back where you want them is a good approach. A couple of 
observations:

1. How do you handle: WAtermelon-U-8-1-2-Green or 1-800-EAT-****? I'd have
a 
TALLY REPLACING to convert ABC = 2, DEF=3, etc. before the numeric 
validation.

2. Moving the result to a numeric field is not the best practice. Numeric 
fields (in my view) should be used for fields on which arithmetic can be 
performed. That means that telephone numbers, social security numbers, ZIP

codes, part identifiers, and so on should be alphanumeric.

For example, suppose you have postal codes defined as numeric and your 
company opens a branch office in Canada. Canada uses letters for postal 
codes, some of which are in French. Big re-write.
 




 13 Posts in Topic:
Numeric comparison
jeff <jmoore207@[EMAIL  2008-03-09 14:16:59 
Re: Numeric comparison
"tlmfru" <la  2008-03-09 16:41:46 
Re: Numeric comparison
jeff <jmoore207@[EMAIL  2008-03-09 14:49:47 
Re: Numeric comparison
"William M. Klein&qu  2008-03-09 22:27:05 
Re: Numeric comparison
docdwarf@[EMAIL PROTECTED  2008-03-09 23:26:52 
Re: Numeric comparison
jeff <jmoore207@[EMAIL  2008-03-09 16:36:31 
Re: Numeric comparison
docdwarf@[EMAIL PROTECTED  2008-03-10 01:29:54 
Re: Numeric comparison
"HeyBub" <he  2008-03-09 19:03:03 
Re: Numeric comparison
"Pete Dashwood"  2008-03-10 15:56:54 
Re: Numeric comparison
"HeyBub" <he  2008-03-10 08:20:25 
Re: Numeric comparison
Howard Brazee <howard@  2008-03-10 09:37:35 
Re: Numeric comparison
tim <TimJ@[EMAIL PROTE  2008-03-10 06:54:56 
Re: Numeric comparison
Howard Brazee <howard@  2008-03-10 09:39:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 16:38:59 CDT 2008.