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 

need to pull out group of records based on cond

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


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Fri Aug 14, 2009 3:52 pm    Post subject: need to pull out group of records based on cond Reply with quote

I have a file with many different types of records with say FB and 80 bytes

Code:

ABC
DEF
111111111111
1001   ABC
1001   ABC
BBBBBBBB
1001   ABC
1001   ABC
1001      XYZ   
.
.
.
2002   ABC
2002   ABC
2002      XYZ
2002   
2002
200222222222
20033333333
..

I want to pull out group of records which have only as below , note there are could be many 1001 or 2001 or any different number records but i want to pull out those records which have XYZ followed at the end of similar type and always they will occur in group of 3 records.
Code:

1001   ABC
1001   ABC
1001      XYZ
2002   ABC
2002   ABC
2002      XYZ
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Aug 17, 2009 12:17 pm    Post subject: Reply with quote

yadav2005,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
ABC                                                               
DEF                                                               
111111111111                                                       
1001   ABC                                                         
1001   ABC                                                         
BBBBBBBB                                                           
1001   ABC                                                         
1001   ABC                                                         
1001      XYZ                                                     
2002   ABC                                                         
2002   ABC                                                         
2002      XYZ                                                     
2002                                                               
2002                                                               
200222222222                                                       
20033333333                                                       
..                                                                 
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),               
  IFTHEN=(WHEN=(11,3,CH,EQ,C'XYZ'),                               
  OVERLAY=(81:81,8,ZD,SUB,+3,M11,LENGTH=8))                       
  SORT FIELDS=(81,8,CH,A),EQUALS                                   
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(11,3,CH,EQ,C'XYZ'),RECORDS=3,   
  PUSH=(89:11,3,ID=8,1,80))                                       
  OUTFIL REMOVECC,BUILD=(1,80),                                   
  INCLUDE=(89,3,CH,EQ,C'XYZ',AND,11,3,CH,NE,C'XYZ'),               
  SECTIONS=(92,8,TRAILER3=(100,80))                               
/*

_________________
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