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
 

 

Count records excluding header/trailer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
gaurav.rajvanshi

New User


Joined: 08 Jul 2010
Posts: 23
Location: Mainframe World

PostPosted: Thu Sep 15, 2011 6:15 pm    Post subject: Count records excluding header/trailer
Reply with quote

My file has multiple headers/trailers. I require the count of the records excluding the headers/trailers but for specific headers/trailers.

Sample File is like:
HDR 0001
Rec1
Rec2
Rec3
TRL 0001
HDR 0002
Rec1
Rec2
TRL 0002
HDR 0003
Rec1
Rec2
Rec3
TRL 0003

I want output like
HDR 0001 : Count = 3
HDR 0002 : Count = 2
HDR 0003 : Count = 3
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7307

PostPosted: Thu Sep 15, 2011 7:16 pm    Post subject: Reply to: Count records excluding header/trailer
Reply with quote

And how are you doing so far? What have you tried? Where is it not working?

Have you looked through the forum for any examples which you might be able to modify? Have you googled for same?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Sep 15, 2011 10:12 pm    Post subject:
Reply with quote

gaurav.rajvanshi,

Assuming that your input is FB RECFM and LRECL = 80 , the following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
HDR 0001                                                             
REC1                                                                 
REC2                                                                 
REC3                                                                 
TRL 0001                                                             
HDR 0002                                                             
REC1                                                                 
REC2                                                                 
TRL 0002                                                             
HDR 0003                                                             
REC1                                                                 
REC2                                                                 
REC3                                                                 
TRL 0003                                                             
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(81:5,4))   
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X),                             
  SECTIONS=(81,4,TRAILER3=('HDR ',81,4,' : ',COUNT-2=(M10,LENGTH=6)))
//*



output is
Code:

HDR 0001 :      3
HDR 0002 :      2
HDR 0003 :      3
Back to top
View user's profile Send private message
gaurav.rajvanshi

New User


Joined: 08 Jul 2010
Posts: 23
Location: Mainframe World

PostPosted: Fri Sep 16, 2011 12:59 am    Post subject: Reply to: Count records excluding header/trailer
Reply with quote

Thanks a lot Skolusu icon_biggrin.gif
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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
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


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