Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

extract Top Level Domain of the email-id

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Wed Mar 24, 2010 9:10 pm    Post subject: extract Top Level Domain of the email-id
Reply with quote

Hi all,

I have input field WS-EMAIL-ID with PIC X(80).
I may expect input values like
asdfg@yahoo.co.in
xyz@yahoo.com
abc@yahoo.co.in.edu

I need to extract Top Level Domain of the email-id which is
asdfg@yahoo.co.in -- in
xyz@yahoo.com -- com
abc@yahoo.co.in.edu -- edu

we can have more than 6 qualifier in domain name.

in other words need to extract data after last DOT(.)

came any one please help me on this..
Back to top
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Wed Mar 24, 2010 9:16 pm    Post subject:
Reply with quote

Hello,

As you requested, the duplicate topic has been removed.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Mar 24, 2010 9:17 pm    Post subject:
Reply with quote

Hello,

One way to get what you want is to UNSTRING the email-id into multiple work-fields delimiting by the period. The last field filled will contain the "top level domain".
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Wed Mar 24, 2010 10:03 pm    Post subject:
Reply with quote

Or use FUNCTION REVERSE, grab everything before the first period, and then use FUNCTION REVERSE again.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Mar 25, 2010 12:00 am    Post subject: Re: extract Top Level Domain of the email-id
Reply with quote

sashi wrote:
in other words need to extract data after last DOT(.)

UNSTRING WS-EMAIL-ID DELIMITED BY '.' INTO Top-Level-Domain where Top-Level-Domain is a pic 80 too....
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Mar 25, 2010 12:04 am    Post subject:
Reply with quote

Hello,

Ok, i'm really slow today. . .

Will this work for multi-dot e-addrs?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Mar 25, 2010 12:11 am    Post subject:
Reply with quote

AFAIK, the unstring generates a move (with blank padding) to the into field without regard to whether the into field is the same as the one before or not....
Even if the move does not pad, the count in function will make it easy anyway..
This assumes that the email data does not have any trailing 'dots'....
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Mar 25, 2010 12:28 am    Post subject:
Reply with quote

Hello,

From the example "input" - abc@yahoo.co.in.edu

After the unstring i believe the "Top-Level-Domain" will contain "abc@yahoo". . .
Corrected
The requirement (if i understand correctly) is that "edu" should be returned as the Top-Level-Domain . . . What have i missed?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Mar 25, 2010 1:34 am    Post subject:
Reply with quote

Quote:
What have i missed?
The "DELIMITED BY '.'"?
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Mar 25, 2010 1:54 am    Post subject:
Reply with quote

Hello,

Nope - saw that. . icon_smile.gif . But that will only process one period. . . It will then quit.

This
Code:
       01  EADDR PIC X(30) VALUE 'THENAME@AB.CD.EF.EDU'.
       01  TOP-LEVEL-DOMAIN PIC X(80) VALUE SPACES.     

          UNSTRING EADDR DELIMITED BY '.' INTO TOP-LEVEL-DOMAIN.
          DISPLAY TOP-LEVEL-DOMAIN.           


Gives:
THENAME@AB
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Mar 25, 2010 2:14 am    Post subject:
Reply with quote

Quote:
But that will only process one period. . . It will then quit.
Oops, my bad..... icon_redface.gif
Code:
UNSTRING EADDR
   DELIMITED BY '.'
   INTO TOP-LEVEL-DOMAIN
        TOP-LEVEL-DOMAIN
        TOP-LEVEL-DOMAIN
        .
        .
        .
        TOP-LEVEL-DOMAIN
        TOP-LEVEL-DOMAIN
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Thu Mar 25, 2010 2:35 am    Post subject:
Reply with quote

This works better than the UNSTRING alone:
Robert Sample wrote:
Or use FUNCTION REVERSE, grab everything before the first period, and then use FUNCTION REVERSE again.

or you can:
use FUNCTION REVERSE to inverse the mail-address,
INSPECT TALLYING FOR FIRST '.' to locate the fist point (reversed, it is the last)
COMPUTE pos = length - tally +2 to locate after the last point (in non reversed string)
and MOVE the mail-address (pos:tally - 1) to the domain string
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Thu Mar 25, 2010 2:36 am    Post subject:
Reply with quote

and don't forget to put a MOVE 0 TO tally before the INSPECT.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm
No new posts Syncsort TPF Level Majid Hussain SYNCSORT 2 Wed Apr 13, 2016 2:22 am
No new posts How to send email with Rich Text usin... santhosh5983 JCL & VSAM 4 Fri Apr 08, 2016 2:30 am
No new posts Sort Logic to extract data scorp_rahul23 DFSORT/ICETOOL 13 Tue Mar 01, 2016 1:22 am
No new posts how to extract the member name ? jackzhang75 CLIST & REXX 1 Wed Feb 17, 2016 9:21 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us