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 

Split a record into two using DFSORT.

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


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Mon Apr 20, 2009 10:32 am    Post subject: Split a record into two using DFSORT. Reply with quote

I think I saw a solution on this board, but can't find out now. Here is what I am trying (the reverse of Combine multiple records into one record listed in dfsort tricks)

input LRECL 250
------
Code:

Record 1Record 2Record 3
Record 4Record 5Record 6
Record 7Record 8

output LRECL 80
Code:

-------
Record 1
Record 2
Record 3
Record 4
Record 5
Record 6
Record 7
Record 8
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Apr 20, 2009 11:09 am    Post subject: Reply with quote

Sreejith,

The following DFSORT JCL will give you the desired results. I assumed that you don't want to split the record if it has spaces.Since there are 3 different chunks of 80 byte data to check , the unique combinations will be 3 factorial which is 6. so we check for the 6 possible values and write out the records. These checks are to ensure that you don't write out blank records.

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=Yu=our 250 byte input file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,240,C'111')),               
  IFTHEN=(WHEN=(001,1,CH,EQ,C' '),OVERLAY=(241:C'0'),HIT=NEXT),
  IFTHEN=(WHEN=(081,1,CH,EQ,C' '),OVERLAY=(242:C'0'),HIT=NEXT),
  IFTHEN=(WHEN=(161,1,CH,EQ,C' '),OVERLAY=(243:C'0'))           
                                                               
  OUTFIL IFOUTLEN=80,OMIT=(241,3,ZD,EQ,0),                     
  IFTHEN=(WHEN=(241,3,ZD,EQ,001),BUILD=(161,80)),               
  IFTHEN=(WHEN=(241,3,ZD,EQ,010),BUILD=(81,80)),               
  IFTHEN=(WHEN=(241,3,ZD,EQ,011),BUILD=(81,80,/,161,80)),       
  IFTHEN=(WHEN=(241,3,ZD,EQ,100),BUILD=(1,80)),                 
  IFTHEN=(WHEN=(241,3,ZD,EQ,101),BUILD=(1,80,/,161,80)),       
  IFTHEN=(WHEN=(241,3,ZD,EQ,110),BUILD=(1,80,/,81,80)),         
  IFTHEN=(WHEN=(241,3,ZD,EQ,111),BUILD=(1,80,/,81,80,/,161,80))
/*   

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Mon Apr 20, 2009 11:40 am    Post subject: Reply with quote

Kolusu,
Thanks very much. As usual it worked very well.

The actual data length is 230 in my case and the third split neatly came out with 10 spaces at the end.

Sreejith
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Apr 20, 2009 11:44 am    Post subject: Reply with quote

Sreejith wrote:
Kolusu,
Thanks very much. As usual it worked very well.

The actual data length is 230 in my case and the third split neatly came out with 10 spaces at the end.

Sreejith


Sreejith,

Glad it worked. You mentioned that your input LRECL is 250 in your initial post.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Mon Apr 20, 2009 12:29 pm    Post subject: Reply with quote

that's right. the lrecl is 250. but the data ends at 230 and remaining is just filler
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
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