Phone_Number MATCHES '3N1X3N1X4N'

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ranga1970
Participant
Posts: 141
Joined: Thu Nov 04, 2004 3:29 pm
Location: Hyderabad

Phone_Number MATCHES '3N1X3N1X4N'

Post by ranga1970 »

Hi;
I was going through code some else developed and it was checking for a constraint Phone_Number MATCHES '3N1X3N1X4N' ; What does this mean;
I have an incoming phone number is having an value 9208455403; but this was rejected as for this constraint , could some one tell me how the incoming number should be to pass this constraint.
as we all know 10 digits phone number is valid in USA and 9208455403 is an ten digit number how the form of this should be to pass the above constraint
920-845-5403
920X845X5403 or any other format what exacrly 3N1X3N1X4N' mean
RRCHINTALA
Vishvas
Participant
Posts: 34
Joined: Sat Jun 21, 2003 3:52 am

Post by Vishvas »

Its a pattern matching string. So the match will happen only if the phone number has 3 Numeric chars, 1 alpha numeric char, 3 Numeric chars, 1 alpha numeric char & 4 Numeric chars (i.e. 920-845-5403, etc.)
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

3N1X3N1X4N means
three Number-one character-three Number-one character-four Number.

Remember, that this is only true for Canada+USA. Internationaly there is a ISO-Standard for phone-numbers, which makes a phonenumberb look like +<country Code>-<local Code>-phone-number-extention.

+1-902-8455403 for the number you mention

country codes are between one (7 for Russia, 1 for North America) and three digit (342 for Slovakia)
local codes are between one (France) and up to 5 digits (Germany)
telefone-numbers are between 3 (Germany) and up to 15 digits (Germany) even in same local zones.

So ISO is best for telefone and telefax.

Wolfgang
rsaliah
Participant
Posts: 65
Joined: Thu Feb 27, 2003 8:59 am

Post by rsaliah »

Match is a pattern matching operator for which you can get good information on DS Help and Basic Manual.

What your constraint is checking is the format is 3 numeric, 1 char of any type, 3 numeric, 1 char of any type, 4 numeric. i.e. 123-123-1234
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A ten digit number will never match that pattern, because that pattern matches a string containing three digits, one "any" character, three more digits, one more "any" character then four more digits. If your source data are purely numeric, you may prefer

Code: Select all

InLink.Phone_Number MATCHES "10N" 
as your test.

If you want to be able to match either, you can have a multi-valued match pattern; the @VM signifies "or" in some sense. For example

Code: Select all

InLink.Phone_Number MATCHES "10N" : @VM : "3N1X3N1X4N"
You can be explicit about the characters in the match pattern by turning them into literal (quoted) strings. For example

Code: Select all

InLink.Phone_Number MATCHES "3N'-'3N'-'4N"


For another example, a pattern to match the ISO standard would be

Code: Select all

"'+'1N0N'-'1N0N'-'1N0N"
The zero in these pattern elements means "any number of" so that this pattern recognizes strings made up of a "+" character, at least one numeric character, a "-" character, at least one numeric character, a "-" and at least one numeric character. That is, "1N0N" means "at least one numeric character" because it means "one numeric character followed by any number of numeric characters (including none)".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ranga1970
Participant
Posts: 141
Joined: Thu Nov 04, 2004 3:29 pm
Location: Hyderabad

Post by ranga1970 »

Thanks all
RRCHINTALA
Post Reply