Minoru Massaki at IBM Mainframe Discussion List <IBM-MAIN@bama.ua.edu>
wrote on 02/27/2012 10:46:57 AM:
> I have to do following by DFSORT
>
> There is a data set which contains records with dsname, time, and
> status as following
> (dsname, time, status fields are fixed length)
> The records are sorted by dsname and time.
>
>    dsn-aaa    08:00  open
>    dsn-aaa    08:10  close
>    dsn-aaa    08:15  delete
>    dsn-bbb    07:55  delete
>    dsn-ccc    08:05  open
>    dsn-ccc    08:07  close
>
> I want to get a record by each dsname from multiple records as following.
> (each dsname has max 8 records(status))
>
>    dsn-aaa    08:00  open  08:10  close  08:15  delete
>    dsn-bbb    07:55  delete
>    dsn-ccc    08:05  open  08:07  close

You can use a DFSORT/ICETOOL job like the following.  I assumed your
records
were already in order by the dsname as implied by your example.  If not,
remove the
OPTION COPY statement:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
dsn-aaa    08:00  open
dsn-aaa    08:10  close
dsn-aaa    08:15  delete
dsn-bbb    07:55  delete
dsn-ccc    08:05  open
dsn-ccc    08:07  close
dsn-ddd    08:01  open
dsn-ddd    08:02  close
dsn-ddd    08:03  open
dsn-ddd    08:04  close
dsn-ddd    08:05  open
dsn-ddd    08:06  close
dsn-ddd    08:07  open
dsn-ddd    08:08  close
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,11,CH) KEEPNODUPS WITHEACH -
  WITH(26,14) WITH(40,14) WITH(54,14) WITH(68,14) -
  WITH(82,14) WITH(96,14) WITH(110,14) USING(CTL1)
//CTL1CNTL DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,11),PUSH=(125:SEQ=1)),
    IFTHEN=(WHEN=(125,1,ZD,EQ,2),BUILD=(1,11,26:12,14)),
    IFTHEN=(WHEN=(125,1,ZD,EQ,3),BUILD=(1,11,40:12,14)),
    IFTHEN=(WHEN=(125,1,ZD,EQ,4),BUILD=(1,11,54:12,14)),
    IFTHEN=(WHEN=(125,1,ZD,EQ,5),BUILD=(1,11,68:12,14)),
    IFTHEN=(WHEN=(125,1,ZD,EQ,6),BUILD=(1,11,82:12,14)),
    IFTHEN=(WHEN=(125,1,ZD,EQ,7),BUILD=(1,11,96:12,14)),
    IFTHEN=(WHEN=(125,1,ZD,EQ,8),BUILD=(1,11,110:12,14))
  OUTFIL BUILD=(1,123)
/*

Frank Yaeger - DFSORT Development Team (IBM) - yae...@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, 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 lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to