|
View previous topic :: View next topic
|
| Author |
Message |
sashi
New User

Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
As you requested, the duplicate topic has been removed. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
| Or use FUNCTION REVERSE, grab everything before the first period, and then use FUNCTION REVERSE again. |
|
| Back to top |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
| 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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Ok, i'm really slow today. . .
Will this work for multi-dot e-addrs? |
|
| Back to top |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
From the example "input" - [email protected]
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 |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
| Quote: |
| What have i missed? |
The "DELIMITED BY '.'"? |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Nope - saw that. . . But that will only process one period. . . It will then quit.
This
| Code: |
01 EADDR PIC X(30) VALUE '[email protected]'.
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 |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
| Quote: |
| But that will only process one period. . . It will then quit. |
Oops, my bad.....
| Code: |
UNSTRING EADDR
DELIMITED BY '.'
INTO TOP-LEVEL-DOMAIN
TOP-LEVEL-DOMAIN
TOP-LEVEL-DOMAIN
.
.
.
TOP-LEVEL-DOMAIN
TOP-LEVEL-DOMAIN |
|
|
| Back to top |
|
 |
Marso
REXX Moderator

Joined: 13 Mar 2006 Posts: 1356 Location: Israel
|
|
|
|
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 |
|
 |
Marso
REXX Moderator

Joined: 13 Mar 2006 Posts: 1356 Location: Israel
|
|
|
|
| and don't forget to put a MOVE 0 TO tally before the INSPECT. |
|
| Back to top |
|
 |
|
|