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
 

 

Verifying an email id in a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Verifying an email id in a file
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    Post subject: Reply to: Verifying an email id in a file
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: 1219
Location: Israel

PostPosted: Sun Oct 12, 2014 2:14 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7240

PostPosted: Sun Oct 12, 2014 3:24 pm    Post subject: Reply to: Verifying an email id in a file
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: 1219
Location: Israel

PostPosted: Sun Oct 12, 2014 5:51 pm    Post subject:
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    Post subject:
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: 1219
Location: Israel

PostPosted: Mon Oct 13, 2014 10:40 am    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Mon Oct 13, 2014 8:56 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7240

PostPosted: Mon Oct 13, 2014 9:17 pm    Post subject: Reply to: Verifying an email id in a file
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: 1219
Location: Israel

PostPosted: Mon Oct 13, 2014 9:22 pm    Post subject:
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    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7240

PostPosted: Tue Oct 14, 2014 3:16 pm    Post subject: Reply to: Verifying an email id in a file
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    Post subject: Reply to: Verifying an email id in a file
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    Post subject: Re: Reply to: Verifying an email id in a file
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    Post subject:
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: 1219
Location: Israel

PostPosted: Wed Oct 22, 2014 1:16 pm    Post subject: Re: Verifying an email id in a file
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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