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] [email protected] [email protected] [email protected] [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] [email protected] [email protected] [email protected] [email protected] Further if you have questions please let me know Thanks, Kolusu DFSORT Development IBM Corporation From: Edward Gould <[email protected]> To: [email protected] Date: 07/15/2017 12:29 PM Subject: Sort Question Sent by: IBM Mainframe Discussion List <[email protected]> One of my users asked me this question and I am not quite clear on how to respond. Given an email address [email protected] <mailto:[email protected]> (example) He just wants to sort on the field before the @ and then for a secondary sort the bbb field. Both fields are variable in length (not sure what the max is). Any suggestions on how to do this? I have tried RTFM but maybe I am not looking at the question correctly . Ed ---------------------------------------------------------------------- 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
