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.


|