View previous topic :: View next topic |
Author |
Message |
tcurrier Intermediate
Joined: 10 Feb 2006 Posts: 188 Topics: 68
|
Posted: Tue Dec 07, 2010 10:32 am Post subject: Insert blank line on break in sorted key field value |
|
|
Hello... I have a 133 byte file that is sorted on a field starting in byte 25 for a length of 14 bytes.
I would like to insert a blank line in the file when there is a change in the value of the field in bytes 25-38
Code: | In:
11111111111111
11111111111111
11111111111111
22222222222222
22222222222222
Out:
11111111111111
11111111111111
11111111111111
22222222222222
22222222222222 |
Using SYNCSORT, I tried the following control cards:
//SYSIN DD *
OPTION EQUALS
MERGE FIELDS=(1,133,CH,A)
OUTFIL SECTIONS=(25,14,SKIP=L)
/*
But am getting the following error:
WER068A OUT OF SEQ SORTIN01 , BLOCK 1
Can anyone help out with this ?
Thanks... |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Dec 07, 2010 11:35 am Post subject: |
|
|
tcurrier,
I am being generous today, you can use the following JCL.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input 133 dsn,disp=shr
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(25,14,CH,A),EQUALS
OUTFIL REMOVECC,SECTIONS=(25,14,TRAILER3=(133X))
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
tcurrier Intermediate
Joined: 10 Feb 2006 Posts: 188 Topics: 68
|
Posted: Tue Dec 07, 2010 12:27 pm Post subject: |
|
|
Thanks, Kolusu...
I'll consider that an early Christmas present |
|
Back to top |
|
|
tcurrier Intermediate
Joined: 10 Feb 2006 Posts: 188 Topics: 68
|
Posted: Thu Sep 08, 2011 2:02 pm Post subject: insert blank lines conditionally |
|
|
OK, expanding on this a little... I ran into a situation where I want to insert a blank line whenever I hit a certain value in the file...
Code: | TYPE
AUTO
1992 PLYMOUTH
TYPE
HOME
RANCH
TYPE
BOAT
ALUMINUM FISHING |
So, whenever I see 'TYPE' in bytes 1-4, I want to insert a blank line.
Code: |
TYPE
AUTO
1992 PLYMOUTH
TYPE
HOME
RANCH
TYPE
BOAT
ALUMINUM FISHING |
Thanks for any help. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Sep 08, 2011 2:39 pm Post subject: |
|
|
tcurrier,
Assuming 80 byte lrecl, you can use a DFSORT job like this:
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
TYPE
AUTO
1992 PLYMOUTH
TYPE
HOME
RANCH
TYPE
BOAT
ALUMINUM FISHING
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL IFTHEN=(WHEN=(1,4,CH,EQ,C'TYPE'),BUILD=(80X,/,1,80))
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
tcurrier Intermediate
Joined: 10 Feb 2006 Posts: 188 Topics: 68
|
Posted: Sat Sep 10, 2011 11:58 am Post subject: |
|
|
Thank you, Kolusu .... |
|
Back to top |
|
|
|
|