MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Insert blank line on break in sorted key field value

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Tue Dec 07, 2010 10:32 am    Post subject: Insert blank line on break in sorted key field value Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Dec 07, 2010 11:35 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Tue Dec 07, 2010 12:27 pm    Post subject: Reply with quote

Thanks, Kolusu...

I'll consider that an early Christmas present Wink
Back to top
View user's profile Send private message
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Thu Sep 08, 2011 2:02 pm    Post subject: insert blank lines conditionally Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Sep 08, 2011 2:39 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Sat Sep 10, 2011 11:58 am    Post subject: Reply with quote

Thank you, Kolusu ....
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group