View previous topic :: View next topic
|
Author |
Message |
balusengodan
New User
Joined: 01 Mar 2005 Posts: 15 Location: chennai
|
|
|
|
how can i get hte total number of records present in a file?..
is there any solutions? please answers to this question? |
|
Back to top |
|
|
sivatechdrive
Active User
Joined: 17 Oct 2004 Posts: 191 Location: hyderabad
|
|
|
|
HI balu
the is a count function in DFSort
COUNT is an automatic DFSORT maintained counter of all records for this statement.
SORT FIELDS=(1,15,CH,A)
OUTFIL TRAILER1=(20:'NUMBER OF RECORDS ON FILE? ,COUNT),NODETAIL
In this example a count of the number of records on the input file is printed at the end of sorting. The NODETAIL specifies that no detail lines are to be printed. If this was not specified every record would be printed unformatted.
for more information..click on..
www.damos.dircon.co.uk/html/dfsort_reports.html
COUNT - prints a message containing the count of records in a data set. Can also be used to set RC=12 or RC=0 based on the count of records in a data set (that is, empty, not empty, higher, lower, equal or not equal).
for more information..click on..
www-1.ibm.com/servers/storage/support/software/sort/mvs/professor_sort/srtmatol.html |
|
Back to top |
|
|
somasundaran_k
Active User
Joined: 03 Jun 2003 Posts: 134
|
|
|
|
Hi
As mentioned by Siva you can use SYNCSORT/DFSORT to get the count.
Also you can FILEAID too.
SORT solution.
----------------
If you have DFSORT change SYNCTOOL to ICETOOL. Check the TOOLMSG
to find the count.
Code: |
//COUNT EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INPFILE DD DSN=YOUR INPUT FILE,
// DISP=SHR
//TOOLIN DD *
COUNT FROM(INPFILE)
/*
|
Fileaid Solution.
-----------------
Check the SYSPRINT.
Code: |
//STEP1 EXEC PGM=FILEAID
//*
//DD01 DD DSN=YOUR INPUT FILE,
// DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSLST DD SYSOUT=*
//SYSIN DD *
$$DD01 TALLY
/*
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job to get one output record with the count.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(COUNT=(M11,LENGTH=8))
/*
|
Note that COUNT=(M11,LENGTH=8) gives us an 8-byte count with leading zeros. COUNT=(TO=ZD,LENGTH=8) would do that as well. We could use other edit masks or conversion formats to display the count in other ways, e.g. COUNT=(EDIT=(III,IIT)) or COUNT=(TO=FS,LENGTH=8).
We also use NODETAIL to suppress the detail records, and REMOVECC to suppress the ANSI carriage control character.
Alternatively, you can use the COUNT operator of DFSORT's ICETOOL to display the COUNT in a message in the TOOLMSG data set. |
|
Back to top |
|
|
|