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
