On Wed, 16 Apr 2014 09:01:28 +0000, Sankaranarayanan, Vignesh wrote:
>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
If the file's RECFM is FB, with a record size of 150, this should work:
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'I'),
OVERLAY=(151:C'0 0 0 0 ')),
IFTHEN=(WHEN=NONE,
PARSE=(%01=(ENDBEFR=C'.',FIXLEN=3),
%02=(ENDBEFR=C'.',FIXLEN=3),
%03=(ENDBEFR=C'.',FIXLEN=3),
%04=(ENDBEFR=C',',FIXLEN=3)),
OVERLAY=(151:%01,%02,%03,%04))
SORT FORMAT=UFF,FIELDS=(151,3,A,154,3,A,157,3,A,160,3,A)
OUTREC BUILD=(1,150)
You would need to make adjustments in OVERLAY, FIELDS, and BUILD for a
different record length.
Bill
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN