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: 7255

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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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