How to keep the header with group data?



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to keep the header with group data?

Postby j2422tw » Thu Nov 01, 2007 11:12 am

My request is to keep the group data and its header.

The input :

Header:            date1 time 1
Data item A
Data item A
Data item A
Data item A
Data item A
Header:            date1 time2
Header:            date1 time3
Header:            date1 time4
Header:            date2 time1
Header:            date2 time2
Header:            date2 time3
Header:            date2 time4
Data item B
Data item B
Data item B
Header:            date2 time5
Header:            date2 time6
Header:            date2 time7
Data item C
Data item C
Data item C
Data item C
Header:            date2 time8
Header:            date3 time1


The output:

Header:            date1 time 1
Data item A
Data item A
Data item A
Data item A
Data item A
Header:            date2 time4
Data item B
Data item B
Data item B
Header:            date2 time7
Data item C
Data item C
Data item C
Data item C


The record length is 40 and fix.

Thanks very much!
j2422tw
 
Posts: 25
Joined: Wed Sep 19, 2007 9:46 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to keep the header with group data?

 

Re: How to keep the header with group data?

Postby Frank Yaeger » Fri Nov 02, 2007 1:30 am

Here's a DFSORT/ICETOOL job that will do what you asked for:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/40)
//OUT DD DSN=...  output file (FB/40)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(41,8,PD) KEEPBASE -
 WITHALL WITH(1,40) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(41:SEQNUM,8,PD)),
        IFTHEN=(WHEN=(1,7,CH,EQ,C'Header:'),
                OVERLAY=(41:SEQNUM,8,PD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(49:SEQNUM,8,PD,
                         41:41,8,PD,SUB,49,8,PD,TO=PD,LENGTH=8))
  OUTFIL FNAMES=OUT,BUILD=(1,40)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: How to keep the header with group data?

Postby j2422tw » Fri Nov 02, 2007 6:40 am

:)
That's exactly I want, thank you very much.
j2422tw
 
Posts: 25
Joined: Wed Sep 19, 2007 9:46 am
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post