View previous topic :: View next topic
|
Author |
Message |
bravas
New User
Joined: 31 Oct 2008 Posts: 6 Location: madrid
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
DFSORT / SYNCSORT / CA-SORT would probably be the most efficient. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
You can use SORT utility for the same... |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
bravas
New User
Joined: 31 Oct 2008 Posts: 6 Location: madrid
|
|
|
|
Thanks a lot ,It is very useful for me this information.
I will try to see if it works, thanks again |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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:
The count in the output file can be formatted in various ways. |
|
Back to top |
|
|
Balakrishnan
New User
Joined: 21 Aug 2009 Posts: 3 Location: US
|
|
|
|
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 |
|
|
|