Validating E-mail

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
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Validating E-mail

Post by yaminids »

Hello all,

Can anybody provide me a routine to validate e-mail address. I want to check the following condition to validate e-mail(xxxx@xxx.xxx).

Thanx in advance.
-Yamini
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I would use the pattern matching of DataStage BASIC for a rough filter of valid e-mail addresses. I would use the MATCHES function and the pattern you might use is "0X'@'0X'.com'" or "0X'@'0X'.'3X" if all of the expected addresses are to ".com"s or 3-digit suffixes. If this isn't sufficient then at least you have somewhere to start .
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Beware, though, that not all email addresses have a three digit suffix. We've had .co.uk (and other countries) since day 1, and now .info and .name (and .tv and the like) are becoming more popular.

If you need to use the MATCHES operator against a list of possibilities, there's a cute trick using a multi-valued list of match patterns. For example:

Code: Select all

Email.Address MATCHES "0X'@'0X'.'3A" : @VM : "0X'@'0X'.'2A'" : @VM : "0X'@'0X'.'4A'"
Put the most likely candidate at the head of the list and the least likely candidate at the end of the list.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Validating E-mail

Post by yaminids »

Hello all,
Thank you very much for ur help.
-Yamini
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Validating E-mail

Post by yaminids »

Hello Ray,

I know its too long to ask a question regarding this posting but I have a small problem in implementing the logic. When I am trying to validate an e-mail your condition is working fine for all conditions except when the email-id is in the following format:

abcdef@yahoo.

Can you help me in re-coding the Mathces statement?

Thank you very much in advance.
-Yamini
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is that really a valid email address??

Code: Select all

Upcase(Email.Address) MATCHES "0X'@'0X'.'3A" : @VM : "0X'@'0X'.'2A'" : @VM : "0X'@'0X'.'4A'" : @VM : "0X'@YAHOO.'"
would handle just the yahoo case in a non-case-sensitive manner. I suspect you don't want to handle all possible string@string. addresses since most of these will be erroneous.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply