>>I see the following room for improvement: 1. Do NOT limit domain field 
to first dot. Just take it as whole string.
Example of sorted domains

R.S

My earlier job was just an untested sample that I wrote on the weekend to 
meet Edward's requirement.  Here is a fully tested version and it takes 
into consideration all the points raised here so far.  Thanks paul for 
sending in some sample data. It also handles the lower case and upper 
case. We only convert the parsed values to upper case and leave the 
original record as is.

I did not code the OUTREC statement to remove the parsed fields as I 
wanted to show how the values are parsed. If the job met all your 
requirements then simply add OUTREC BUILD=(1,80)

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD * 
John Sr Doe <[email protected]>, 
SORT EXPERT <[email protected]>, 
[email protected], 
<[email protected]>, 
<"JOHNDOE"@US.IBM.COM>, 
(MUST BE EQUIVALENT) <"JOHNDOE"@US.IBM.COM>, 
(OPTIONALLY DISTINCT) <"JOHNDOE"@US.IBM.COM>, 
(MAY BE REJECTED BY IBM) <"JOHNDOE+FOLDER"@US.IBM.COM> 
[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 
//SORTOUT  DD SYSOUT=* 
  INREC IFTHEN=(WHEN=INIT, 
         PARSE=(%01=(ENDBEFR=C'@',FIXLEN=50),   $ GET FIELD BEFORE @ 
                %02=(ENDBEFR=C'>',              $ GET FIELD BEFORE < 
                     ENDBEFR=C',',              $ GET FIELD BEFORE , 
                     ENDBEFR=C' ',FIXLEN=50)),  $ GET FIELD BEFORE ' '
   OVERLAY=(081:%01,TRAN=LTOU,                  $ PUT NAME AT 81 
            C'#$%&',                            $ ADD SPL CHAR #$%& 
            135:%02,TRAN=LTOU)),                $ PUT DOMAIN AT 135 
   IFTHEN=(WHEN=INIT, 
          PARSE=(%03=(ABSPOS=81,STARTAFT=C'<',  $ REPARSE THE NAME 
                     ENDBEFR=C'#$%&',           $ SPL CHAR AS STOPPER 
                     FIXLEN=50)), 
   OVERLAY=(185:%03)),                          $ PUT NAME AT 185 
 
  IFTHEN=(WHEN=INIT, 
   FINDREP=(STARTPOS=181,INOUT=(C'"',C''))),    $ REPLACE THE " 
 
 
  IFTHEN=(WHEN=(185,50,CH,GT,C' '), 
  BUILD=(001,80,                                $ ORIGINAL REC 
         185,50,                                $ NAME 
         135,50)),                              $ DOMAIN 
 
  IFTHEN=(WHEN=NONE, 
  BUILD=(001,80,                                $ ORIGINAL REC 
         081,50,                                $ NAME 
         135,50))                               $ DOMAIN 
 
  SORT FIELDS=(081,50,CH,A,                     $ NAME 
               131,50,CH,A),EQUALS              $ DOMAIN 
/* 
 

Thanks,
Kolusu
DFSORT Development
IBM Corporation



From:   "R.S." <[email protected]>
To:     [email protected]
Date:   07/17/2017 05:00 AM
Subject:        Re: Sort Question
Sent by:        IBM Mainframe Discussion List <[email protected]>



I see the following room for improvement:
1. Do NOT limit domain field to first dot. Just take it as whole string.
Example of sorted domains
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
How to change "%02=(ENDBEFR=C'.',FIXLEN=30)" to something like "%02=rest 
of record" ?
My idea is to put the following:
%02=(ENDBEFR=X'40',FIXLEN=30)   *just check for space after the record

2. Uppercase and lowercase sorted in same order. For simplicity it can 
also convert UTOL or LTOU.
I think, for small datasets it is reasonable to use pre-step with UTOL 
(first step converts UTOL, second do the main sort).

3. (next level of complexity). Provide "exceptions" for multiple-domain 
companies
Example:
[email protected]
[email protected]
[email protected]
are equal.
I have no idea here :-(

Regards
-- 
Radoslaw Skorupka
Lodz, Poland






W dniu 2017-07-16 o 16:38, Sri h Kolusu pisze:
>>> ... all challenges for DFSORT; some not algorithmically solvable.
> Paul,
> '
> Can you send me a sample of data with all the challenging scenarios and 
I
> will *try* to see if I can solve it. For a fully tested solution it 
would
> be only on Monday.
>
> Thanks,
> Kolusu
>
> IBM Mainframe Discussion List <[email protected]> wrote on
> 07/16/2017 07:28:19 AM:
>
>> From: Paul Gilmartin <[email protected]>
>> To: [email protected]
>> Date: 07/16/2017 07:28 AM
>> Subject: Re: Sort Question
>> Sent by: IBM Mainframe Discussion List <[email protected]>
>>
>> On Sat, 15 Jul 2017 14:18:41 -0500, Edward Gould wrote:
>>
>>> 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 .
>> (From RFC 822:
>>       addr-spec   =  local-part "@" domain        ; global address )
>>
>> The domain is specified (Internet standard) to be case-insensitive.
>>
>> The interpretation of the local-part is left entirely up to the server,
>> which may treat it as case-sensitive or insensitive.
>>
>> If the local-part contains special characters, it must be surrounded by
>> quotation marks.  If there are no special characters, the quotation
>> marks are optional.
>>
>> Mappings may make domains equivalent.  For example, my domain
>> may be written as "AIM.com" or "AOL.Com"
>>
>> Some servers (not all) accept userID"+"subaccount as a local-part,
>> delivering mail to userID and allowing rules in userID's MUA to
>> sort messages into folders.
>>
>> And a comment may be profided as a "phrase" in "mailbox"
>>
>>       mailbox     =  addr-spec                    ; simple address
>>                   /  phrase route-addr            ; name & addr-spec
>>
>>       route-addr  =  "<" [route] addr-spec ">"
>>
>> ... all challenges for DFSORT; some not algorithmically solvable.
>>
>> -- gil
>>
>> ----------------------------------------------------------------------
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to [email protected] with the message: INFO IBM-MAIN
>>

======================================================================


        --
 Treść tej wiadomości może zawierać informacje prawnie chronione Banku 
przeznaczone wyłącznie do użytku służbowego adresata. Odbiorcą może być 
jedynie jej adresat z wyłączeniem dostępu osób trzecich. Jeżeli nie jesteś 
adresatem niniejszej wiadomości lub pracownikiem upoważnionym do jej 
przekazania adresatowi, informujemy, że jej rozpowszechnianie, kopiowanie, 
rozprowadzanie lub inne działanie o podobnym charakterze jest prawnie 
zabronione i może być karalne. Jeżeli otrzymałeś tę wiadomość omyłkowo, 
prosimy niezwłocznie zawiadomić nadawcę wysyłając odpowiedź oraz trwale 
usunąć tę wiadomość włączając w to wszelkie jej kopie wydrukowane lub 
zapisane na dysku.

 This e-mail may contain legally privileged information of the Bank and is 
intended solely for business use of the addressee. This e-mail may only be 
received by the addressee and may not be disclosed to any third parties. 
If you are not the intended addressee of this e-mail or the employee 
authorized to forward it to the addressee, be advised that any 
dissemination, copying, distribution or any other similar activity is 
legally prohibited and may be punishable. If you received this e-mail by 
mistake please advise the sender immediately by using the reply facility 
in your e-mail software and delete permanently this e-mail including any 
copies of it either printed or saved to hard drive.

 mBank S.A. z siedzibą w Warszawie, ul. Senatorska 18, 00-950 Warszawa, 
www.mBank.pl, e-mail: [email protected]ąd Rejonowy dla m. st. Warszawy XII 
Wydział Gospodarczy Krajowego Rejestru Sądowego, nr rejestru 
przedsiębiorców KRS 0000025237, NIP: 526-021-50-88. Według stanu na dzień 
01.01.2016 r. kapitał zakładowy mBanku S.A. (w całości wpłacony) wynosi 
168.955.696 złotych.
 

----------------------------------------------------------------------
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

Reply via email to