IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to include header and some detail lines but not others


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
AllyDick

New User


Joined: 07 Dec 2019
Posts: 5
Location: Ireland

PostPosted: Sun Dec 08, 2019 10:19 pm
Reply with quote

Hi,
I have a file that contains content that is similar to below:

HEADERxxxxxxxxxxxAxxxxxxxxxxxx
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
HEADERxxxxxxxxxxxBxxxxxxxxxxxx
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
HEADERxxxxxxxxxxxAxxxxxxxxxxxx
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
HEADERxxxxxxxxxxxBxxxxxxxxxxxx
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa


Header lines have either A or B in column 19.

I want to output to a file that ONLY contains HEADERs with an A in column 19 PLUS any DETAIL lines that are under those header lines.

So output that only includes the items in block:

HEADERxxxxxxxxxxxAxxxxxxxxxxxx
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa

HEADERxxxxxxxxxxxBxxxxxxxxxxxx
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
HEADERxxxxxxxxxxxAxxxxxxxxxxxx
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa

HEADERxxxxxxxxxxxBxxxxxxxxxxxx
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa

The DETAIL lines do not have distinguishing features that can tie them to the HEADER lines.

Anyone any idea how you could do this please?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1252
Location: Bamberg, Germany

PostPosted: Mon Dec 09, 2019 6:52 pm
Reply with quote

Code:
//SIMPLE   EXEC PGM=ICEMAN,PARM='MSG=AP'                             
//SORTIN   DD *                                                       
HEADERxxxxxxxxxxxAxxxxxxxxxxxx                                       
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa                                       
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa                                       
HEADERxxxxxxxxxxxBxxxxxxxxxxxx                                       
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa                                       
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa                                       
HEADERxxxxxxxxxxxAxxxxxxxxxxxx                                       
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa                                       
HEADERxxxxxxxxxxxBxxxxxxxxxxxx                                       
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa                                       
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa                                       
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa                                       
/*                                                                   
//SYSOUT   DD SYSOUT=*                                               
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  OPTION COPY                                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'HEADER'),PUSH=(60:18,1))
  OUTFIL INCLUDE=(60,1,CH,EQ,C'A'),BUILD=(1,59)
  END                                                                 
/*                                                                   


Code:
HEADERxxxxxxxxxxxAxxxxxxxxxxxx   
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa 
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa 
HEADERxxxxxxxxxxxAxxxxxxxxxxxx   
DETAILaaaaaaaaaaaaaaaaaaaaaaaaa 
Back to top
View user's profile Send private message
AllyDick

New User


Joined: 07 Dec 2019
Posts: 5
Location: Ireland

PostPosted: Mon Dec 09, 2019 8:31 pm
Reply with quote

Thank you so much for that response. This is brilliant and worked! Very much appreciated
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts I need a 4 lines block where substrin... DFSORT/ICETOOL 12
No new posts Copy few lines from SYSOUT of 10 mill... All Other Mainframe Topics 5
No new posts Generate output lines (SYSIN card for... DFSORT/ICETOOL 4
Search our Forums:

Back to Top