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

How to find the total number of records in a file


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

New User


Joined: 01 Mar 2005
Posts: 15
Location: chennai

PostPosted: Mon Mar 21, 2005 11:45 am
Reply with quote

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
View user's profile Send private message
sivatechdrive

Active User


Joined: 17 Oct 2004
Posts: 191
Location: hyderabad

PostPosted: Mon Mar 21, 2005 2:30 pm
Reply with quote

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
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Wed Mar 23, 2005 9:59 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Mar 23, 2005 11:43 pm
Reply with quote

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
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 Unable to interpret a hex value to De... COBOL Programming 4
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts how to eliminate null indicator value... DB2 7
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
Search our Forums:

Back to Top