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

Dfsort Question: Want to count the records in this file


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

New User


Joined: 27 Jul 2005
Posts: 2
Location: China

PostPosted: Wed Jul 27, 2005 1:12 pm
Reply with quote

Assume I have a sequential file as following:
HDR20050710
DTLaaaaaaaa
DTLbbbbbbbb
...
TRL00000000

Now I want to count the records in this file, including HDR, DTL & TRL, and put the result to the last of TRL, for example:
HDR20050710
DTLaaaaaaaa
DTLbbbbbbbb
TRL00000004

Can dfsort achieve it? Anybody can help?
Thanks in advance.
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: Wed Jul 27, 2005 9:05 pm
Reply with quote

You can use the DFSORT job below to do what you asked for. You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's new COUNT+n function. Only DFSORT has this function, so if you don't have DFSORT, you won't be able to use it. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000088

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
HDR20050710
DTLaaaaaaaa
DTLbbbbbbbb
TRL00000000
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
* Remove trailer record.
  OMIT COND=(1,3,CH,EQ,C'TRL')
* Write new trailer record with count of header, data and
* trailer records.
  OUTFIL REMOVECC,TRAILER1=('TRL',COUNT+1=(M11,LENGTH=8))
/*
Back to top
View user's profile Send private message
Julian

New User


Joined: 27 Jul 2005
Posts: 2
Location: China

PostPosted: Thu Jul 28, 2005 6:33 am
Reply with quote

Thank you, Frank.
That's very kind of you :-)
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 Nov 20, 2010 3:17 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 trailer record directly like this:

Code:

//NEW   EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
HDR20050710
DTLaaaaaaaa
DTLbbbbbbbb
TRL00000000
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL IFTRAIL=(TRLID=(1,3,CH,EQ,C'TRL'),
    TRLUPD=(4:COUNT+1=(M11,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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top