IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

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

Active User


Joined: 15 Aug 2015
Posts: 350
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 All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
No new posts Join lines with dfsort DFSORT/ICETOOL 5
No new posts Required Date Format in Include Sort ... DFSORT/ICETOOL 6
No new posts Insert System Runtime in HEADER In SY... SYNCSORT 9
No new posts using TXT2PDF to colour specific lines All Other Mainframe Topics 3

Back to Top