Vignesh,

The following DFSORT/ICETOOL JCL will give you the desired results. I 
assumed that you have 1 header record which you want to retain as is

//STEP0100 EXEC PGM=ICETOOL 
//TOOLMSG  DD SYSOUT=* 
//DFSMSG   DD SYSOUT=* 
//IN       DD * 
IP,MAC,MAKE-MODEL,SEPINFO,TYPE,PING,STATUS,PRINTER,GRPNAME WA
192.23.55.223,UNKNOWN,UNKNOWN,OKI,REPORT,NOT OK,UNKNOWN,ABCD,
192.1.3.28,UNKNOWN,UNKNOWN,NOT DEFINED,REPORT,NOT OK,UNKNOWN,
23.192.53.1,AAA,BB:CC:DD:EE:FF:GG,ZTC GK420D,NOT 
//OUT      DD SYSOUT=* 
//TOOLIN   DD * 
  DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1) 
//CTL1CNTL DD * 
  INREC PARSE=(%01=(ENDBEFR=C'.',FIXLEN=3), 
               %02=(ENDBEFR=C'.',FIXLEN=3), 
               %03=(ENDBEFR=C'.',FIXLEN=3), 
               %04=(ENDBEFR=C',',FIXLEN=3)), 
   OVERLAY=(134:%01,UFF,EDIT=(TTT), 
                %02,UFF,EDIT=(TTT), 
                %03,UFF,EDIT=(TTT), 
                %04,UFF,EDIT=(TTT)) 
 
  SORT FIELDS=(134,12,CH,A) 
  OUTFIL BUILD=(1,133) 
//*        
The output from this job is 

IP,MAC,MAKE-MODEL,SEPINFO,TYPE,PING,STATUS,PRINTER,GRPNAME WAREHOUSE 
23.192.53.1,AAA,BB:CC:DD:EE:FF:GG,ZTC GK420D,NOT 
192.1.3.28,UNKNOWN,UNKNOWN,NOT DEFINED,REPORT,NOT OK,UNKNOWN,EFGH,NOT 
192.23.55.223,UNKNOWN,UNKNOWN,OKI,REPORT,NOT OK,UNKNOWN,ABCD,NOT DEFINED

If you don't have the header then, you can use the following

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD * 
192.23.55.223,UNKNOWN,UNKNOWN,OKI,REPORT,NOT OK,UNKNOWN,ABCD,
192.1.3.28,UNKNOWN,UNKNOWN,NOT DEFINED,REPORT,NOT OK,UNKNOWN,
23.192.53.1,AAA,BB:CC:DD:EE:FF:GG,ZTC GK420D,NOT 
//SORTOUT  DD SYSOUT=* 
//SYSIN    DD * 
  INREC PARSE=(%01=(ENDBEFR=C'.',FIXLEN=3), 
               %02=(ENDBEFR=C'.',FIXLEN=3), 
               %03=(ENDBEFR=C'.',FIXLEN=3), 
               %04=(ENDBEFR=C',',FIXLEN=3)), 
   OVERLAY=(134:%01,UFF,EDIT=(TTT), 
                %02,UFF,EDIT=(TTT), 
                %03,UFF,EDIT=(TTT), 
                %04,UFF,EDIT=(TTT)) 
 
  SORT FIELDS=(134,12,CH,A) 
  OUTREC BUILD=(1,133) 
//* 

The output will be the same except you don't have the header. 

Further if you have any questions please let me know.

Thanks,
Kolusu
DFSORT Development
IBM Corporation

IBM Mainframe Discussion List <[email protected]> wrote on 
04/16/2014 02:01:28 AM:

> From: "Sankaranarayanan, Vignesh" <Vignesh.V.Sankaranarayanan@MARKS-
> AND-SPENCER.COM>
> To: [email protected], 
> Date: 04/16/2014 02:12 AM
> Subject: Sorting CSV data that begins with an IP address
> Sent by: IBM Mainframe Discussion List <[email protected]>
> 
> Hello,
> 
> I need help sorting some 5000 lines based on the first entry in a 
> CSV - IP address. When sorting, I need the whole record to be 
> involved in the sort, not just the IP's.
> 
> Sample data:
> 
> IP,MAC,Make-Model,SEPINFO,Type,Ping,Status,Printer,GRPNAME Warehouse
> #,Warehouse Name,Warehouse Terminal,Warehouse Code, Warehouse CICS
> xx.yyy.zz.aaa,Unknown,Unknown,OKI,Report,NOT Ok,Unknown,abcd,Not Defined
> xx.yyy.zzz.a,Unknown,Unknown,Not Defined,Report,NOT 
> Ok,Unknown,efgh,Not Defined
> xx.yy.zzz.aaa,bb:cc:dd:ee:ff:gg,ZTC GK420d,Not 
> Defined,Report,Ok,Online,qwer,WHW
> 
> Xx doesn't mean the same digit; just clearing out data. I require 
> the sort to work for any IP address, be it 1 or 2 or 3 characters per 
octet.
> 
> I'm working with this, and I haven't a clue on each of these 
> keywords. If you guys were so kind as to help me with the SYSIN, I 
> could save an hour or two of reading syntax rules.
> 
> INREC IFTHEN=(WHEN=INIT,
>   PARSE=(%01=(ENDBEFR=C'.',FIXLEN=3),
>          %02=(ENDBEFR=C'.',FIXLEN=3),
>          %03=(ENDBEFR=C'.',FIXLEN=3),
>          %04=(FIXLEN=3)),
>   OVERLAY=(81:%01,%02,%03,%04))
> SORT FORMAT=UFF,FIELDS=(81,3,A,84,3,A,87,3,A,90,3,A)
> OUTREC BUILD=(1,133)
> 
> 
> Thanks in advance.
> 
> - Vignesh
> Mainframe Admin
> 
> 
> MARKSANDSPENCER.COM
> ________________________________
> Unless otherwise stated above:
> Marks and Spencer plc
> Registered Office:
> Waterside House
> 35 North Wharf Road
> London
> W2 1NW
> 
> Registered No. 214436 in England and Wales.
> 
> Telephone (020) 7935 4422
> Facsimile (020) 7487 2670
> 
> www.marksandspencer.com
> 
> Please note that electronic mail may be monitored.
> 
> This e-mail is confidential. If you received it by mistake, please 
> let us know and then delete it from your system; you should not 
> copy, disclose, or distribute its contents to anyone nor act in 
> reliance on this e-mail, as this is prohibited and may be unlawful.
> 
> ----------------------------------------------------------------------
> 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