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

need to count and display the count in trailer


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

New User


Joined: 21 Nov 2006
Posts: 50
Location: India

PostPosted: Sat Jan 26, 2008 12:01 am
Reply with quote

hi,

there are 10 records in a file with one header and one trailer.
i need to count the numbber of records including the header and trailer and display the count in the trailer record .this should be done in a single step.

input:
header
record1
record2
record3
record4
record5
record6
record7
record8
trailer


output:
header
record1
record2
record3
record4
record5
record6
record7
record8
trailer 10

please help me on this
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat Jan 26, 2008 12:23 am
Reply with quote

try the following control cards

Code:

//SYSIN    DD *                             
  OPTION COPY                               
  INREC IFOUTLEN=80,                         
        IFTHEN=(WHEN=INIT,                   
       OVERLAY=(81:SEQNUM,8,ZD)),           
        IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),
       OVERLAY=(09:81,8,ZD,M10))                 
/*                                           
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jan 26, 2008 2:14 am
Reply with quote

Here's another way to do it with DFSORT, assuming that you just need 'TRAILER' and the count in the trailer record (Kolusu's method can pick up the existing fields in the trailer and just add the count).

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=...  input file
//SORTOUT  DD DSN=...  output file
//SYSIN    DD *
  OPTION COPY
  OMIT COND=(1,7,CH,EQ,C'TRAILER')
  OUTFIL REMOVECC,
   TRAILER1=('TRAILER',9:COUNT+1=(M10,LENGTH=8))
/*
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Fri Feb 29, 2008 8:39 pm
Reply with quote

could you please explain all the control cards and its uses,
it will be very useful for us!!!!!!!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 29, 2008 10:26 pm
Reply with quote

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Nov 09, 2010 2:48 am
Reply with quote

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can now use DFSORT's new IFTRAIL function to update the existing trailer with the count like this:

Code:

//NEW EXEC PGM=ICEMAN                                             
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD DSN=...  input file
//SORTOUT  DD DSN=...  output file
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  OUTFIL IFTRAIL=(HD=YES,TRLID=(1,7,CH,EQ,C'TRAILER'),             
   TRLUPD=(9:COUNT+2=(M10,LENGTH=8)))                             
/*                                                                 


For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
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 To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
Search our Forums:

Back to Top