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

Active User


Joined: 15 Aug 2015
Posts: 397
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 exclude the 5 first lines for compare... TSO/ISPF 2
This topic is locked: you cannot edit posts or make replies. include and copy COBOL Programming 4
No new posts Remove additional information in SUPE... TSO/ISPF 10
No new posts include cond ascii constant DFSORT/ICETOOL 4
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
Search our Forums:

Back to Top