Add Blank record after each date change - SORT



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

Add Blank record after each date change - SORT

Postby Kitz » Fri May 13, 2011 2:56 pm

Please help me to dispay a blank record after sort (date change)

Input

ABCDEFGH 1105121600
ABCXXXGH 1105121600
ABXXXXKH 1105121600
KXXAAALK 1105141600
CDEFGHLK 1105131600
CDEKKKLK 1105131600
BAAAAALK 1105141600
CDXXXHLK 1105131600


I was sorting my fileds like:
SORT FIELDS=(9,6,CH,A,1,8,CH,A)

My output should display something like below:
ABCDEFGH 1105121600
ABCXXXGH 1105121600
ABXXXXKH 1105121600

CDEFGHLK 1105131600
CDEKKKLK 1105131600
CDXXXHLK 1105131600

BAAAAALK 1105141600
KXXAAALK 1105141600

A blank record needs to be displayed after each date change. Could anyone help? Is it possible with SORT?

Thanks & Regards,
Kitz
Kitz
 
Posts: 47
Joined: Thu Mar 17, 2011 3:46 am
Has thanked: 0 time
Been thanked: 1 time

Re: Add Blank record after each date change - SORT

Postby Kitz » Fri May 13, 2011 9:09 pm

It worked for me; here's the code:
SORT FIELDS=(9,6,CH,A,1,8,CH,A)
OUTFIL REMOVECC,SECTIONS=(9,6,SKIP=L)

Thanks & Regards,
Kitz
Kitz
 
Posts: 47
Joined: Thu Mar 17, 2011 3:46 am
Has thanked: 0 time
Been thanked: 1 time

Re: Add Blank record after each date change - SORT

Postby Frank Yaeger » Fri May 13, 2011 9:12 pm

Your date field positions seem a bit off. It appears to be 10,10 rather than 9,6. Given that, here's a DFSORT job that will do what you asked for:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  SORT FIELDS=(10,10,CH,A,1,8,CH,A)
  OUTFIL REMOVECC,
    SECTIONS=(10,10,SKIP=1L)
/*

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: Add Blank record after each date change - SORT

Postby Kitz » Fri May 13, 2011 9:17 pm

Hi Frank, Hope you are doing good.

Yes, the date field appears at 10. Sorry for that.

It worked and thanks for your help.

Thanks & Regards,
Kitz
Kitz
 
Posts: 47
Joined: Thu Mar 17, 2011 3:46 am
Has thanked: 0 time
Been thanked: 1 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post