On Feb 19, 7:36 am, Arju wrote:
> I have a lot many ip addresses to maintain.
> Like:
> 151.123.108.5
> ....
> I would like to sort them ascending based on ip address.
> I could do this with:
> sort -n -t. +0 -1 +1 -2 +2 -3 +3 -4  filename > outfile.
> in unix. But just for curiosity, can we do this with icetool? Or with
> ispf editor?

You can use DFSORT's PARSE function to sort ip addresses.
(Of course, you can use do it with an ICETOOL SORT operator as well.)
Here's an example:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
151.123.108.5
10.251.6.170
151.123.129.129
151.123.236.18
151.123.111.5
151.123.113.5
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  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,80)
/*

SORTOUT would have:

10.251.6.170
151.123.108.5
151.123.111.5
151.123.113.5
151.123.129.129
151.123.236.18

Frank Yaeger - DFSORT Development Team (IBM) - [email protected]
Specialties: FINDREP, WHEN=GROUP, DATASORT, ICETOOL, Symbols, Migration

 => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to