IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Unstring operation: extract the domain name from E-mail ID


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
link.pradeep

New User


Joined: 21 Dec 2006
Posts: 7
Location: delhi

PostPosted: Tue Aug 07, 2007 11:15 am
Reply with quote

Hi All
i have e-mail ID of customer's and i want to extract the domain name from E-mail ID through unstring with pointer verb. Plz suggest me.
Ex xxx.yyy@yahoo.com --- yahoo
aaa.bbb@yahoo.co.in --- yahoo
Back to top
View user's profile Send private message
Raphael Bacay

New User


Joined: 04 May 2007
Posts: 58
Location: Manila, Philippines

PostPosted: Tue Aug 07, 2007 12:07 pm
Reply with quote

Hi!

Can you try

UNSTRING FIELD-A DELIMITED BY '@' AND '.'
INTO FIELD-DOMAIN.


Thanks.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 07, 2007 9:45 pm
Reply with quote

Hello,

A bit more definition please.

Do you want whatever value is between the @ and the first period after the @? What should be the output of admin@mega.service.com or John.A.Smith@uth.tmc.edu icon_question.gif

You mentioned "pointer". Is there some requirement for this, or were you just thinking out loud?
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Tue Aug 07, 2007 10:34 pm
Reply with quote

I know of people who have addresses like JohnSmith@mail.yahoo.com. What is the output here? mail, yahoo, com, mail.yahoo, yahoo.com, mail.yahoo.com?

Email addresses are horrendous for parsing. An @ character is valid in the first part of an email address if it is written like this "John@Smith"@yahoo.com (I think that is the format. RFC 822 or 2822 defines the valid format of an email address). If you were to unstring this using @ you wouldn't get what you want either. If COBOL could handle regular expressions, life gets somewhat easier for parsing and validating email address, but it is still "not cool".
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Aug 08, 2007 2:24 am
Reply with quote

Hello,

As with most things, before we can offer usable suggestions, we need to know all of the rules. . .

Keep in mind that to do what you need may take more than one statement. It may be necessary to determine in which format a particular string "fits", then using the rules for that format, the needed value(s) can be "parsed" from the string.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts optim extract file - SAS DB2 2
No new posts How to extract the data for current y... DFSORT/ICETOOL 8
No new posts Extract record using 2 input file int... JCL & VSAM 2
Search our Forums:

Back to Top