Delete duplicate headers and keep group records



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

Delete duplicate headers and keep group records

Postby Irene Ioujanina » Tue Feb 17, 2009 10:58 pm

Hi, I really appreciate if you can help with the following... There are groups of records, each group starts with one record of the header. Need to keep the sequence of all records, and just delete the same headers ... Can recognize the header record by the constant 'Header' in 1thru 6 positions.
Input:
---------
Header A1
data1
data2
data3
header A2
data4
data5
header A2
data6
data7
header A2
data8
header A3
data9

Output:
----------
Header A1
data1
data2
data3
header A2
data4
data5
data6
data7
data8
header A3
data9

Thanking in advance.
Irene Ioujanina
 
Posts: 27
Joined: Thu Feb 21, 2008 6:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Delete duplicate headers and keep group records

Postby Frank Yaeger » Wed Feb 18, 2009 12:24 am

You can use a DFSORT job like the following to do what you asked for. I changed 'header' to 'Header' in your records per your statement:

Can recognize the header record by the constant 'Header' in 1thru 6 positions


If the identifier is really 'header' instead of 'Header', change the job accordingly.

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
Header A1
data1
data2
data3
Header A2
data4
data5
Header A2
data6
data7
Header A2
data8
Header A3
data9
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,6,CH,EQ,C'Header'),
    OVERLAY=(81:SEQNUM,8,ZD,RESTART=(8,2)))
  OUTFIL OMIT=(81,8,ZD,GT,1),BUILD=(1,80)
/*
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: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Delete duplicate headers and keep group records

Postby Irene Ioujanina » Wed Feb 18, 2009 12:44 am

Brilliant . well....as usual :) .
Thanks a lot.
Irene Ioujanina
 
Posts: 27
Joined: Thu Feb 21, 2008 6:42 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post