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
 

 

need to count and display the count in trailer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: need to count and display the count in trailer
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    Post subject: Reply to: need to count and display the count in trailer
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 Moderator


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

PostPosted: Sat Jan 26, 2008 2:14 am    Post subject:
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    Post subject: hi frank
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 Moderator


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

PostPosted: Fri Feb 29, 2008 10:26 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Nov 09, 2010 2:48 am    Post subject:
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:

http://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    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 Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Display ZEDLMSG without Pressing F1 &... anandgbe CLIST & REXX 8 Thu Dec 15, 2016 4:20 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


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