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

Verifying an email id in a file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Sun Oct 12, 2014 4:24 am
Reply with quote

Hi,

I have a requirement to validate email address in a file before its send to a third party. This limitation being that the validation need to be done only using DFSORT.

The validation is to verify @ is present in an email address and first .(dot) is present the domain name. The validation of @ is easy in a an email id using FINDREP.


Basically i should verify there is a @ and there is atleast a .(dot) in the domain name for an email id.

For example:

xyz@gmail.com
abcded@yahoo.co.uk
mnop@aol.com
def@au.com

Since the first dot in the above domain names varies, i dont have an idea as how to validate the email id field for a dot following @.

The file format is FB, the total file length being 300 bytes and the email field starts from 200 and of 100 bytes long.

Since the domain names can vary, the first .(dot) postion can vary. The @ and the first . dot validation be performed in a single DFSORT step?

Please,Any suggestions/help on this ?

Invalid email id's to be written to a reject file.

Thanks
Back to top
View user's profile Send private message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Sun Oct 12, 2014 1:05 pm
Reply with quote

Please can anyone help/suggest as how this can be performed?

Any queries/suggestions are welcome..

Thanks
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sun Oct 12, 2014 2:14 pm
Reply with quote

Not many people working today...
This will give you a good lead:
Code:
//S1       EXEC  PGM=SORT                                               
//SYSOUT   DD    SYSOUT=*                                               
//SORTIN   DD    *                                                     
            xyz@gmail.com                                               
            inv#gmail.com                                               
            abcded@yahoo.co.uk                                         
            inval@yahoocouk                                             
            bad@mymail.                                                 
            mnop@aol.com                                               
            def@au.com                                                 
            @funky.com                                                 
//SORTOF01 DD   SYSOUT=*                                               
//SORTOF02 DD   SYSOUT=*                                               
//SYSIN    DD    *                                                     
 OPTION   COPY                                                         
 INREC    PARSE=(%01=(ENDBEFR=C'@',FIXLEN=1,ABSPOS=12),
                 %02=(ENDBEFR=C'.',FIXLEN=1),                           
                 %03=(ENDBEFR=C' ',FIXLEN=1)),                         
          BUILD=(1,80,%01,%02,%03)                                     
 OUTFIL   FILES=01,INCLUDE=(81,1,CH,NE,C' ',AND,                       
          82,1,CH,NE,C' ',AND,83,1,CH,NE,C' ')                         
 OUTFIL   FILES=02,INCLUDE=(81,1,CH,EQ,C' ',OR,                         
          82,1,CH,EQ,C' ',OR,83,1,CH,EQ,C' ')                           
/*                                                                     
I hope you will manage from here...
Back to top
View user's profile Send private message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Sun Oct 12, 2014 2:46 pm
Reply with quote

Thank you very much for quick reply. I have some point to start with.
I am working today due to this deployment to be submitted on wednesday..

Will keep you posted!

Thanks
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Oct 12, 2014 3:24 pm
Reply with quote

One of the OUTFIL's can be simplified by using SAVE instead of INCLUDE=/OMIT= with conditions reversed.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sun Oct 12, 2014 5:51 pm
Reply with quote

Code:
 OUTFIL   FILES=02,SAVE
Nice!
No matter how many times I look at the documentation, there is always another parameter... icon_confused.gif

Here is another one:
If the email address doesn't always start exactly at col 200, then you can use 'STARTAT=NONBLANK' in addition to 'ABSPOS=200'
Back to top
View user's profile Send private message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Sun Oct 12, 2014 6:37 pm
Reply with quote

Thank you very much!
It worked and the files were split into two files based on PARSE.

I tried both of INCLUDE and SAVE, retained the SAVE as the code easy to interpret.

The position will always be 200 as the email id is picked from table unload using join keys and position remains fixed.

Thanks for your help!
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Oct 13, 2014 10:40 am
Reply with quote

Of course, you have removed in the OUTFIL the 3 bytes added during the INREC.
I forgot about that.
Back to top
View user's profile Send private message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Mon Oct 13, 2014 8:29 pm
Reply with quote

Marso wrote:
Of course, you have removed in the OUTFIL the 3 bytes added during the INREC.
I forgot about that.


Yes, i did by including an additional OUTREC to remove the last three characters.

Thanks again
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Oct 13, 2014 8:56 pm
Reply with quote

Just a thought ............. as I haven't checked the functionality of the code given

But, what about email addresses such as name.2ndname@whatever.co.uk
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Oct 13, 2014 9:17 pm
Reply with quote

The validation required is very basic. The PARSE will first find the @. The second field of the PARSE will continue from that point. "." prior to the @ will not cause a problem.

shajeeth,

If you post your code, we can suggest a couple of changes.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Oct 13, 2014 9:22 pm
Reply with quote

The address is split into 3 parts (X@Y.Z) and we take the 1st letter of each part.
"name.2ndname@whatever.co.uk" should work.
Back to top
View user's profile Send private message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Mon Oct 13, 2014 9:23 pm
Reply with quote

expat wrote:
Just a thought ............. as I haven't checked the functionality of the code given

But, what about email addresses such as name.2ndname@whatever.co.uk


The code works fine for that too. It basically validates the first character presence, a character after @ presence and a character after . presence

It works fine for : j.wan.hendson@yahoo.co.uk too, the Parse will give the characters as jyc and the OUTFIL INCLUDE validates this.

Thanks!
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Tue Oct 14, 2014 11:51 am
Reply with quote

Shajeeth,

Please test the code for below mentioned email address.

Code:
TEST MAIL@GMAIL.AU
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Oct 14, 2014 3:16 pm
Reply with quote

Sai,

The requirement is for a very basic and limited "validation". Yes, it would accept that, but it meets the spec.
Back to top
View user's profile Send private message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Wed Oct 15, 2014 8:40 pm
Reply with quote

Yes, the requirement still now has been basic and it meets the spec as required.

I will keep you posted if any additional validations would be required.

Thanks!
Back to top
View user's profile Send private message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Tue Oct 21, 2014 9:48 pm
Reply with quote

Bill Woodger wrote:
Sai,

The requirement is for a very basic and limited "validation". Yes, it would accept that, but it meets the spec.


As i had not expected, the requirement has changed. The basic validation works perfectly fine, however as expected it fails for email id's as

xyz@hotmail.c
abc@hotmail.co

Any ideas as how this can also be written into rejects using SORT?

Thanks !
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Oct 22, 2014 12:33 am
Reply with quote

Programs work based on rules. You should tell the rule and most of the cases when you state rule, you understand how it should be handled.

At least this is something you would want to read first
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Oct 22, 2014 1:16 pm
Reply with quote

This thread started with:
shajeeth wrote:
I have a requirement to validate email address in a file before its send to a third party.

1. If more than basic validation is needed, then SORT is the wrong tool for this.
2. The program that write or update records in this file is the one that should validate the email address.

Escapa,
very interesting link.
I knew that "kuki1234@gmail.com" and "kuki.1234@gmail.com" are in fact the same address, and that you can use tags ("kuki1234+NEWS@gmail.com", useful if you use filters), but I thought it was specific to gmail.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top