Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Exclude consecutive Header and Trailer records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Exclude consecutive Header and Trailer records
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    Post subject:
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    Post subject: Reply to: Exclude consecutive Header and Trailer records
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: 578
Location: USA

PostPosted: Thu Jun 23, 2011 8:28 pm    Post subject:
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    Post subject: Reply to: Exclude consecutive Header and Trailer records
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us