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 file based on finding record with particular value

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


Joined: 07 May 2003
Posts: 7
Topics: 2
Location: Seattle

PostPosted: Mon Sep 21, 2015 11:59 am    Post subject: Split file based on finding record with particular value Reply with quote

I've searched on the forum, elsewhere online and in the manuals and can't quite find anything to match what I'm trying to accomplish.
I have a single file (FBA, LRECL=133) that contains two reports, one followed by the other. I simply want to split the file into two separate files, each containing a separate report.
Each report has a unique report name in the headings, like 'REPT301', 'REPT302', starting in column 2. When that 2nd report name is found, I want the records up to that point (1st report) to be put in one file and the remaining records (2nd report) to be put in another file. No sorting.
It sounds so simple... any suggestions would be appreciated.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Sep 21, 2015 12:40 pm    Post subject: Reply with quote

zornet57,

Look at the smart DFSORT trick "Include or omit groups of records" here

http://www-01.ibm.com/support/docview.wss?uid=isg3T7000094
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
zornet57
Beginner


Joined: 07 May 2003
Posts: 7
Topics: 2
Location: Seattle

PostPosted: Mon Sep 21, 2015 1:05 pm    Post subject: Reply with quote

Thank you - I did see that but had hoped there was a simpler way (than having to add a sequence number, sorting, then remove it). If this is the best way to go, that's what I'll do.
I appreciate the quick response, and I enjoy browsing the forums - they often provide the answers I need.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Sep 21, 2015 2:45 pm    Post subject: Reply with quote

zornet57 wrote:
Thank you - I did see that but had hoped there was a simpler way (than having to add a sequence number, sorting, then remove it). If this is the best way to go, that's what I'll do.
I appreciate the quick response, and I enjoy browsing the forums - they often provide the answers I need.


zornet57,

huh? Why do you need to sort it? you just need to copy. It is quite simple. WHEN=GROUP to put the sequence number and validate that sequence on OUTFIL. It can't get any simpler than that.

Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
 REPT301                                                         
   RPT LINE 01                                                   
   RPT LINE 02                                                   
   RPT LINE 03                                                   
   RPT LINE 04                                                   
   RPT LINE 05                                                   
 REPT302                                                         
   RPT LINE 01                                                   
   RPT LINE 02                                                   
//REPT301  DD SYSOUT=*                                           
//REPT302  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,7,SS,EQ,C'REPT301.REPT302'),
          PUSH=(134:ID=1))                                       
                                                                 
  OUTFIL FNAMES=REPT301,BUILD=(1,133),INCLUDE=(134,1,ZD,EQ,1)   
  OUTFIL FNAMES=REPT302,BUILD=(1,133),SAVE
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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