How to get the count of total records

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
subbu
Member
Posts: 9
Joined: Tue Feb 23, 2010 10:57 am

How to get the count of total records

Post by subbu » Fri Sep 13, 2013 2:55 pm

Hi ,
Can any one help me how we can display the total count if records that are present in the header not at the trailer. I used the below logic. It worked for Trailer. But i replaced trailer with Header the job is failing.

//COUNT EXEC PGM=SORT,COND=(0,NE)
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Input file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(COUNT=(M11,LENGTH=10))
/*
Subbu.Ch

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Sep 13, 2013 3:53 pm

The HEADER1 processing is before any records are processed for that OUTFIL. So there can be no COUNT at that time. So it will not work.

subbu
Member
Posts: 9
Joined: Tue Feb 23, 2010 10:57 am

Post by subbu » Fri Sep 13, 2013 4:05 pm

Hi Thanks for the reply.

So is there any other way to get the count value in the HEader?
Subbu.Ch

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Sep 13, 2013 6:08 pm

Not by magic, no.

Why do you want the count in the header? What is the source and destination of your file?

It is possible.

subbu
Member
Posts: 9
Joined: Tue Feb 23, 2010 10:57 am

Post by subbu » Fri Sep 13, 2013 7:39 pm

That is the Requirment which i got. They want the count to be present in the header as soon as they open the file.
My Source is a batch file which generated in the above steps of the JCL.
Destination is some other System.
Subbu.Ch

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Sep 13, 2013 8:20 pm

Well, I don't like the "design". You could drive a very wid truck through the gaps without scraping the sides.

You should be able to find examples of this.

Use JOINKEYS, with the same dataset on both legs of the JOINKEYS.

In JNF2CNTL set a value of one on each record (cut it down so it is almost just that) and use SUM. The only other value you need on the record is something "low" so that the single record which comes out of the JNF2CNTL appears first.

Use JOIN F1,F2,ONLY

Your F2 is the header. Do your remaining formatting.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others