>>>Thanks!… I would never have gotten that without a lot of testing. Also I did not know the first “field” was limited to 30. I learned several things today.
Edward, As retired mainframer pointed out, it was MY assumption about the length being 30. You can have whatever you want. Just change the FIXLEN=30 to whatever you want and change the positions of OVERLAY and SORT fields according to your desired length. >>Also, the first part of the address can contain "." characters, so the second parse will not work correctly in all cases. Walt, Not really. It does not matter as to how many "." you have before "@", the first field parse will ignore the ".". So as long as the string as has "@" character the first parse will be active and only the contents AFTER the "@" will be parsed by the 2nd parse field for the domain. For example if you had [email protected] the first parse field for "@" will get the entire string a.b.c.d and the 2nd parse field for "." will get the email However your scenario for "." is true for domain. As some email address may contain "." for domain. like for example [email protected] In the above case the name will be parsed as walt.farrell and the domain is ONLY parsed to yahoo instead of yahoo.co.uk So if OP's has various combos of records with multiple characters of "." in the domain name, then he needs to account for them which isn't that hard given that he had a template to start with. I just coded it on a saturday night with a sample data shown and it is an untested version. Thanks, Kolusu IBM Mainframe Discussion List <[email protected]> wrote on 07/16/2017 06:33:44 AM: > From: Walt Farrell <[email protected]> > To: [email protected] > Date: 07/16/2017 06:34 AM > Subject: Re: Sort Question > Sent by: IBM Mainframe Discussion List <[email protected]> > > On Sat, 15 Jul 2017 22:52:47 -0500, Edward Gould > <[email protected]> wrote: > > >> On Jul 15, 2017, at 10:39 PM, Sri h Kolusu <[email protected]> wrote: > >> > >> Edward, > >> > >> Here is a DFSORT JCL which will give you the desired results. I assumed > >> that your input file is FB and 80 bytes in length. I also assumed that > >> your name and domain names are each 30 bytes in length. > >> > >> //STEP0100 EXEC PGM=SORT > >> //SYSOUT DD SYSOUT=* > >> //SORTIN DD * > >> [email protected] <mailto:[email protected]> > >> [email protected] <mailto:[email protected]> > >> [email protected] <mailto:[email protected]> > >> [email protected] <mailto:[email protected]> > >> [email protected] <mailto:[email protected]> > >> //SORTOUT DD SYSOUT=* > >> INREC PARSE=(%01=(ENDBEFR=C'@',FIXLEN=30), $ GET FIELD BEFORE @ > >> %02=(ENDBEFR=C'.',FIXLEN=30)), $ GETFIELD BEFORE . > >> OVERLAY=(081:%01, $ PUT NAME AT 81 > >> 111:%02) $ PUT DOMAIN AT 111 > >> > >> SORT FIELDS=(081,30,CH,A, $ NAME > >> 111,30,CH,A),EQUALS $ DOMAIN > >> > >> OUTREC BUILD=(1,80) $ REMOVE TEMP FIELDS > >> /* > >> > >> The output from this field is > >> > >> [email protected] <mailto:[email protected]> > >> [email protected] <mailto:[email protected]> > >> [email protected] <mailto:[email protected]> > >> [email protected] <mailto:[email protected]> > >> [email protected] <mailto:[email protected]> > >> > >> Further if you have questions please let me know > >> > >> Thanks, > >> Kolusu > >> DFSORT Development > >> IBM Corporation > >> > > > >Thanks!… I would never have gotten that without a lot of testing. > Also I did not know the first “field” was limited to 30. I learned > >several things today. > > The part of the email address before the @ is NOT limited to 30 > characters. Nor is the part after the @. Also, the first part of the > address can contain "." characters, so the second parse will not > work correctly in all cases. > > If you can guarantee that the <mailto: name@domain> part will always > be present, then it might be safer to parse that part, looking for > the text between "<mailto: " and "@" and between "@" and ">". But in > any case you will risk truncating the part before the @ unless you > allow for the possibility of it being much longer. > > -- > Walt > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
