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 

DFSORT to Split the records according to the header

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


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Mon Sep 22, 2014 12:36 pm    Post subject: DFSORT to Split the records according to the header Reply with quote

Hi,

I have below input file, with 3 report DF, EE, and GG.

I need to split the input files into three files based on the group header.

Code:

1DF  AABB     
 HEAD1         
 HEAD2         
  ZYKA DATA   
  ZYKA DATA   
1DF  AABB     
 HEAD1         
 HEAD2         
  YYAA DATA   
  ZYYA DATA   
1EE  CCDD     
 HEAD1         
 HEAD2         
 ZYZZ DATA     
 XYZZ DATA     
1DF SSDD       
 HEAD1         
 HEAD2         
 ZYYA DATA     
 ZYYA DATA     
1EE  FFGG     
 HEAD1         
 HEAD2         
 GGYY DATA     
 HHYY DATA     
1GG  FFHH     
 HEAD1         
 HEAD2         
   AAYY DATA   
   AACC DATA   


Output should be

DF-REport File1
Code:

1DF  AABB   
 HEAD1       
 HEAD2       
  ZYKA DATA 
  ZYKA DATA 
1DF  AABB   
 HEAD1       
 HEAD2       
  YYAA DATA 
  ZYYA DATA 
1DF SSDD   
 HEAD1     
 HEAD2     
 ZYYA DATA 
 ZYYA DATA 


EE-Report File2
Code:

1EE  FFGG   
 HEAD1       
 HEAD2       
 GGYY DATA   
 HHYY DATA   


GG-Report - File3
Code:

HEAD1       
HEAD2       
  AAYY DATA
  AACC DATA


Tried Code :
Code:

//SORTOUT DD SYSOUT=*                                               
//EE  DD SYSOUT=*                                                   
//DF  DD SYSOUT=*                                                   
//GG  DD SYSOUT=*                                                   
//SYSIN DD *                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),PUSH(81:1,3))     
  OPTION COPY                                                       
  OUTFIL FNAMES=DF,INCLUDE(81,3,CH,EQ,C'1DF'),BUILD=(1,80)         
  OUTFIL FNAMES=EE,INCLUDE(81,3,CH,EQ,C'1EE'),BUILD=(1,80)         
  OUTFIL FNAMES=GG,INCLUDE(81,3,CH,EQ,C'1GG'),BUILD=(1,80)         
/*                                                                 


Sortout is used for backup copy.
Please advice if i am missing something, or any other best way to achive this ?

Thanks
Magesh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Sep 22, 2014 12:58 pm    Post subject: Reply with quote

Magesh_J wrote:
Please advice if i am missing something, or any other best way to achive this ?


Magesh_J,

why do you need to validate 3 bytes? 2 bytes is more than enough. Just push the contents from byte 2 for a length of 2 bytes. Use the following control cards

Code:

//SORTOUT DD SYSOUT=*                                               
//EE  DD SYSOUT=*                                                   
//DF  DD SYSOUT=*                                                   
//GG  DD SYSOUT=*                                                   
//SYSIN DD *                                                       
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),PUSH(81:2,2))     

  OUTFIL FNAMES=DF,INCLUDE(81,2,CH,EQ,C'DF'),BUILD=(1,80)         
  OUTFIL FNAMES=EE,INCLUDE(81,2,CH,EQ,C'EE'),BUILD=(1,80)         
  OUTFIL FNAMES=GG,INCLUDE(81,2,CH,EQ,C'GG'),BUILD=(1,80)         
/*



Magesh_J wrote:
Sortout is used for backup copy.


Notice that SORTOUT will be 82 bytes as you haven't chopped off the additional bytes that you pushed. Ideally I would add another OUTFIL File with SAVE to have all the records that do not fit the include conditions.
Code:

//OTHER DD SYSOUT=*                                               
//EE  DD SYSOUT=*                                                   
//DF  DD SYSOUT=*                                                   
//GG  DD SYSOUT=*                                                   
//SYSIN DD *                                                       
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),PUSH(81:2,2))     

  OUTFIL FNAMES=DF,INCLUDE(81,2,CH,EQ,C'DF'),BUILD=(1,80)         
  OUTFIL FNAMES=EE,INCLUDE(81,2,CH,EQ,C'EE'),BUILD=(1,80)         
  OUTFIL FNAMES=GG,INCLUDE(81,2,CH,EQ,C'GG'),BUILD=(1,80)         
  OUTFIL FNAMES=OTHER,SAVE,BUILD=(1,80)         
/*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Mon Sep 22, 2014 2:31 pm    Post subject: Reply with quote

Magesh_J,

If your required output for GG is as stated, you'll need a little something extra. Probably a typo?
Back to top
View user's profile Send private message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Tue Sep 23, 2014 6:02 am    Post subject: Reply with quote

Thank you very much Kolusu
Back to top
View user's profile Send private message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Tue Sep 23, 2014 10:50 am    Post subject: Reply with quote

Yes William, Its a typo...

Missed it.

Thanks
Magesh
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