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

Exclude consecutive Header and Trailer records


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

New User


Joined: 30 Dec 2008
Posts: 3
Location: bangalore

PostPosted: Thu Jun 23, 2011 7:48 pm
Reply with quote

Hi

In a given input file with multiple header, detail and trailer records, I want to exclude the headers and trailers that doesnot have any detail records.

For Example, If Header record is identified by UHL1 and trailer record as UTL1, the input file is as below:

Code:
UHL1ASdsdgs
UTL1sdrfgjsfj
UHL1sdfsdduk
478468dfhrlkio
357368sagvblwryhe
1335768asdklsasthjetj
UTL1asrhaeth
UHL1dejj
UTL1dfjmd


The Output file should be as below:
Code:
UHL1sdfsdduk
478468dfhrlkio
357368sagvblwryhe
1335768asdklsasthjetj
UTL1asrhaeth



Can this be handled in Icetool or DFsort ?
Thanks,
Purna
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 23, 2011 7:59 pm
Reply with quote

well you could assign a sequence number, that always restarts at UHL1.
sort the file sequence number desc.
any UTL1 with a sequence of 2, means it and the following UHL1 need to be deleted.

the resort on sequence number ascending, and drop the sequence number.
Back to top
View user's profile Send private message
PurnaShankar

New User


Joined: 30 Dec 2008
Posts: 3
Location: bangalore

PostPosted: Thu Jun 23, 2011 8:06 pm
Reply with quote

That sounds great. Could you please help me how we can generate the sequence number ?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Thu Jun 23, 2011 8:28 pm
Reply with quote

PurnaShankar,
Assuming your input is FB,80. See if below helps...
Code:
//STEP0001 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD *                                               
UHL1ASDSDGS                                                   
UTL1SDRFGJSFJ                                                 
UHL1SDFSDDUK                                                 
478468DFHRLKIO                                               
357368SAGVBLWRYHE                                             
1335768ASDKLSASTHJETJ                                         
UTL1ASRHAETH                                                 
UHL1SDFSDDUK                                                 
478468DFHRLKIO                                               
1335768ASDKLSASTHJETJ                                         
UTL1ASRHAETH                                                 
UHL1SDFSDDUK                                                 
1335768ASDKLSASTHJETJ                                         
UTL1ASRHAETH                                                 
UHL1DEJJ                                                     
UTL1DFJMD                                                     
/*                                                           
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                               
  SELECT FROM(IN) TO(OUT) ON(81,08,ZD) HIGHER(2) USING(CTL1) 
/*                                                           
//CTL1CNTL DD *                                               
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'UHL1'),         
                            END=(1,4,CH,EQ,C'UTL1'),         
               PUSH=(81:ID=8))                               
 OUTFIL FNAMES=OUT,BUILD=(1,80)                               
/*                                                           

OUTPUT
Code:
UHL1SDFSDDUK         
478468DFHRLKIO       
357368SAGVBLWRYHE     
1335768ASDKLSASTHJETJ
UTL1ASRHAETH         
UHL1SDFSDDUK         
478468DFHRLKIO       
1335768ASDKLSASTHJETJ
UTL1ASRHAETH         
UHL1SDFSDDUK         
1335768ASDKLSASTHJETJ
UTL1ASRHAETH         

Thanks,
Back to top
View user's profile Send private message
PurnaShankar

New User


Joined: 30 Dec 2008
Posts: 3
Location: bangalore

PostPosted: Thu Jun 23, 2011 9:49 pm
Reply with quote

Thank you so much......
It works !!!
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
Search our Forums:

Back to Top