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

Utility for counting records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bravas

New User


Joined: 31 Oct 2008
Posts: 6
Location: madrid

PostPosted: Tue Aug 11, 2009 4:51 pm
Reply with quote

Utility for counting records:


Hello everyone, I am looking for an utility for counting records
through a JCL.


There is a program used to count the records in a file?


Thanks in advance
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Aug 11, 2009 4:58 pm
Reply with quote

DFSORT / SYNCSORT / CA-SORT would probably be the most efficient.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Aug 11, 2009 5:00 pm
Reply with quote

You can use SORT utility for the same...
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Aug 11, 2009 5:19 pm
Reply with quote

It would be like this..
Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
  SORT FIELDS=COPY
  OUTFIL REMOVECC,NODETAIL,
   TRAILER1=('No of records: ',COUNT=(M11,LENGTH=8))
/*
Back to top
View user's profile Send private message
bravas

New User


Joined: 31 Oct 2008
Posts: 6
Location: madrid

PostPosted: Tue Aug 11, 2009 5:25 pm
Reply with quote

Thanks a lot ,It is very useful for me this information.


I will try to see if it works, thanks again
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 11, 2009 6:54 pm
Reply with quote

short of putting a counter in the process that generates the file.....
thus saving the need for yet another program execution just to generate a record count

using sort is a good idea.
I would output to a dummy,
and not use the trailer record,
but rely on the counts provided in the statistics of the sort utility.

bad enough somebody thinks he needs to know the record count,
at least derive the count without generating a new files.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Aug 11, 2009 7:00 pm
Reply with quote

Yes, Dick has reiterated a point that I made some weeks ago regarding record counts for files. These should be displayed in the syslog and joblog of the creation job at the very least.

Obviously with external files it may be different if the sender does not notify the receiver of the record count. But then again if you do not know the number of records that you should have received, why bother to count them icon_rolleyes.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Aug 11, 2009 7:41 pm
Reply with quote

DFSORT'S ICEGENER can be used for it..
Code:

//S1    EXEC  PGM=ICEGENER
//SYSPRINT DD SYSOUT=*     
//SYSUT1 DD your input dsn here             
//SYSUT2 DD DUMMY         
//SYSIN    DD DUMMY       


In SYSPRINT you can find
Code:

ICE054I 0 RECORDS - IN: count, OUT: count 
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Aug 11, 2009 9:04 pm
Reply with quote

Unless this is again something to do with crazy tools I'll vote in for Expat and Dick. I, for one, would be intrested to know such a business requirement.
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 Aug 11, 2009 9:54 pm
Reply with quote

The COUNT operator of DFSORT's ICETOOL can be used to display a message with the count and/or create a file with the count.

To display the count in a message:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//TOOLIN DD *
COUNT FROM(IN)
/*


TOOLMSG will have the count in a message. For example:

ICE628I 0 RECORD COUNT: 000000000000007

To write a record with the count (and also display it in a message):

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//CT DD SYSOUT=*
//TOOLIN DD *
COUNT FROM(IN) WRITE(CT)
/*


CT will have the count. For example:

Code:

000000000000007


The count in the output file can be formatted in various ways.
Back to top
View user's profile Send private message
Balakrishnan

New User


Joined: 21 Aug 2009
Posts: 3
Location: US

PostPosted: Fri Aug 21, 2009 12:58 am
Reply with quote

You can also use File-Aid Batch. Just an additional info:

//COUNTSTP EXEC PGM=FILEAID
//DD01 DD DISP=SHR,DSN=USER007.PROCESS.ADDS
//DD02 DD DISP=SHR,DSN=USER007.PROCESS.CHNGS
//DD03 DD DISP=SHR,DSN=USER007.PROCESS.DELS
//SYSIN DD *
$$DD01 TALLY
$$DD02 TALLY
$$DD03 TALLY
//SYSPRINT DD SYSOUT=I
//SYSOUT DD SYSOUT=*
/*
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts REASON 00D70014 in load utility DB2 6
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top