View previous topic :: View next topic
|
Author |
Message |
NeilDev
New User
Joined: 20 Jan 2010 Posts: 5 Location: UK
|
|
|
|
Hi,
I have the following input data:
James Smith 111111
Neil Smith 111111
Nigel Jonesa 222222
Nigel Jonesa 222222
Nigel Jonesb 222222
Richard Jones 333333
and would like to output a blank line at a change of key, so the data looks like this:
James Smith 111111
Neil Smith 111111
Nigel Jonesa 222222
Nigel Jonesa 222222
Nigel Jonesb 222222
Richard Jones 333333
Can anyone help please? |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Below SORT step will give you required result...
Code: |
//STEP10 EXEC PGM=SORT
//SORTIN DD *
JAMES SMITH 111111
NEIL SMITH 111111
NIGEL JONESA 222222
NIGEL JONESA 222222
NIGEL JONESB 222222
RICHARD JONES 333333
/*
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(15,6,ZD,A)
OUTFIL REMOVECC,SECTIONS=(15,6,TRAILER3=(80:X))
/*
|
|
|
Back to top |
|
|
NeilDev
New User
Joined: 20 Jan 2010 Posts: 5 Location: UK
|
|
|
|
Thankyou very much. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a more general way to do this that doesn't require knowing the LRECL of the records:
Code: |
SORT FIELDS=(15,6,ZD,A)
OUTFIL REMOVECC,SECTIONS=(15,6,SKIP=1L)
|
Note that if the records are already in sorted order, it would be more efficient to use COPY rather than SORT. |
|
Back to top |
|
|
|