Count the number of records in a file using SORT
-
- Posts: 33
- Joined: Mon Jul 20, 2009 4:54 pm
- Skillset: COBOL, DB2, JCL, CICS
- Referer: Thro Google
Count the number of records in a file using SORT
Hi, I just want to count the number of records in a file using JCL. Is there any utility to count the number of records? Can anyone help me on this please..
Re: How do we count the number of records in a file using JCL?
Let us clarify exactly what JCL is.
it is Job Control Language.
By itself it does nothing. It is used to invoke the chosen program and to define which datasets are to be used by the DD names associated with the chosen program.
JCL does not have magical powers that solve all problems, JCL is merely the vehicule for telling the processor which program you want it to execute.
So which program do you wish to execute to count the records ?
it is Job Control Language.
By itself it does nothing. It is used to invoke the chosen program and to define which datasets are to be used by the DD names associated with the chosen program.
JCL does not have magical powers that solve all problems, JCL is merely the vehicule for telling the processor which program you want it to execute.
So which program do you wish to execute to count the records ?
-
- Posts: 33
- Joined: Mon Jul 20, 2009 4:54 pm
- Skillset: COBOL, DB2, JCL, CICS
- Referer: Thro Google
-
- Global moderator
- Posts: 369
- Joined: Tue Feb 26, 2008 11:15 pm
- Skillset: Syncsort MFX for z/OS
- Referer: Dick Scherrer
- Location: USA
- Contact:
Re: How do we count the number of records in a file using JCL?
If you have SyncSort for z/OS, here is a sample job that will produce the record count:
Code: Select all
//SORT1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Input.File,DISP=SHR
//SORTOUT DD DSN=Output.File,...
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=OUT,TRAILER1=(1:COUNT),REMOVECC,NODETAIL
/*
-
- Posts: 33
- Joined: Mon Jul 20, 2009 4:54 pm
- Skillset: COBOL, DB2, JCL, CICS
- Referer: Thro Google
Re: How do we count the number of records in a file using JCL?
Hi Alissa Margulies, Thank for this... Can you please explain the following line.. I don't understand..
SORT FIELDS=COPY
OUTFIL FILES=OUT,TRAILER1=(1:COUNT),REMOVECC,NODETAIL

SORT FIELDS=COPY
OUTFIL FILES=OUT,TRAILER1=(1:COUNT),REMOVECC,NODETAIL

-
- Global moderator
- Posts: 369
- Joined: Tue Feb 26, 2008 11:15 pm
- Skillset: Syncsort MFX for z/OS
- Referer: Dick Scherrer
- Location: USA
- Contact:
Re: How do we count the number of records in a file using JCL?
RajendraPrabhuS,
This job creates a report with a single trailer record containing the record count.
The COUNT subparameter of TRAILER1 provides the number of records for the entire report (all the records) starting at position 1.
REMOVECC omits the ANSI carriage control character from all of the report records.
NODETAIL generates a report with no data records, only header and trailer records, as specified.
Hope this helps. Let me know if you have any further questions.
P.S. All of this is fully documented in the SyncSort for z/OS Programmer's Guide. If you are a licensed customer but do not have access to the documentation, please contact SyncSort Mainframe Product Services and we would be happy to provide them to you.
This job creates a report with a single trailer record containing the record count.
The COUNT subparameter of TRAILER1 provides the number of records for the entire report (all the records) starting at position 1.
REMOVECC omits the ANSI carriage control character from all of the report records.
NODETAIL generates a report with no data records, only header and trailer records, as specified.
Hope this helps. Let me know if you have any further questions.
P.S. All of this is fully documented in the SyncSort for z/OS Programmer's Guide. If you are a licensed customer but do not have access to the documentation, please contact SyncSort Mainframe Product Services and we would be happy to provide them to you.
-
- Posts: 33
- Joined: Mon Jul 20, 2009 4:54 pm
- Skillset: COBOL, DB2, JCL, CICS
- Referer: Thro Google
Re: How do we count the number of records in a file using JCL?
Thanks you soo much Alissa
-
- Posts: 13
- Joined: Sat Aug 08, 2009 7:07 am
- Skillset: Jcl, DB2, Easytrieve & VSAM.
- Referer: WEBSITE
Re: How do we count the number of records in a file using JCL?
I have a question, can I count the total records in more than one PS file in the same SYNCSORT step ?
Thanks,
Sri
Sri
-
- Posts: 279
- Joined: Fri Jul 18, 2008 7:46 pm
- Skillset: JCL,COBOL,DB2,IMS/DB,CICS,VSAM
- Referer: I was banned by superk in main forum so I am here
Re: How do we count the number of records in a file using JCL?
Yes. In that case you would be using PGM=SYNCTOOL instead of PGM=SYNCSORT.
Thanks.
Thanks.
-
- Posts: 13
- Joined: Sat Aug 08, 2009 7:07 am
- Skillset: Jcl, DB2, Easytrieve & VSAM.
- Referer: WEBSITE
Re: How do we count the number of records in a file using JCL?
Hi Ranga,
Thanks for your response.
But I dont know the how to use the SYNCTOOL. Can you pls tell me the SYNCTOOL syntax & how to use in my job ?
And also how to check the SYNCTOOL is installed in my system ?
Thanks for your response.
But I dont know the how to use the SYNCTOOL. Can you pls tell me the SYNCTOOL syntax & how to use in my job ?
And also how to check the SYNCTOOL is installed in my system ?
Thanks,
Sri
Sri
-
- Similar Topics
- Replies
- Views
- Last post
-
- 3
- 3724
-
by naveenkumar sudha
View the latest post
Mon May 09, 2022 10:15 pm
-
-
SUM and count of records by key, using SORT utility
by naveenkumar sudha » Mon May 09, 2022 10:11 pm » in DFSORT/ICETOOL/ICEGENER - 2
- 6549
-
by ssbylzh
View the latest post
Sat May 21, 2022 5:10 pm
-
-
-
Split file, SORT then append records.
by Esmayeelhusen » Fri Aug 04, 2023 6:37 pm » in DFSORT/ICETOOL/ICEGENER - 10
- 5577
-
by Esmayeelhusen
View the latest post
Wed Aug 09, 2023 7:39 am
-
-
-
COBOL SORT - How to sort entire file first & sort by Key
by k_ekam » Thu Dec 01, 2022 12:58 pm » in IBM Cobol - 3
- 1574
-
by Robert Sample
View the latest post
Wed Dec 07, 2022 7:32 am
-
-
-
SORT the records based on the second word
by seethahexa » Wed Aug 19, 2020 1:30 pm » in DFSORT/ICETOOL/ICEGENER - 1
- 1422
-
by sergeyken
View the latest post
Wed Aug 19, 2020 6:08 pm
-