Count the number of records in a file using SORT

Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL
RajendraPrabhuS
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

Postby RajendraPrabhuS » Fri Jul 24, 2009 11:27 am

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..

expat
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm

Re: How do we count the number of records in a file using JCL?

Postby expat » Fri Jul 24, 2009 12:00 pm

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 ?

RajendraPrabhuS
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?

Postby RajendraPrabhuS » Fri Jul 24, 2009 1:53 pm

Thanks Swd....

Alissa Margulies
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?

Postby Alissa Margulies » Fri Jul 24, 2009 7:50 pm

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           
/*                                   
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com

RajendraPrabhuS
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?

Postby RajendraPrabhuS » Fri Jul 24, 2009 8:06 pm

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

:?:

Alissa Margulies
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?

Postby Alissa Margulies » Fri Jul 24, 2009 8:22 pm

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.
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com

RajendraPrabhuS
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?

Postby RajendraPrabhuS » Mon Jul 27, 2009 9:30 am

Thanks you soo much Alissa

sricsc
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?

Postby sricsc » Fri Aug 14, 2009 10:54 pm

I have a question, can I count the total records in more than one PS file in the same SYNCSORT step ?
Thanks,
Sri

ranga_subham
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?

Postby ranga_subham » Sat Aug 15, 2009 1:42 am

Yes. In that case you would be using PGM=SYNCTOOL instead of PGM=SYNCSORT.

Thanks.

sricsc
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?

Postby sricsc » Sat Aug 15, 2009 11:52 am

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,
Sri


  • Similar Topics
    Replies
    Views
    Last post