How get totals at bottom of the files

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
Posts: 8
Joined: Mon Feb 27, 2006 4:31 pm
Location: India

How get totals at bottom of the files

Post by mithunthakre » Tue Sep 19, 2006 4:17 pm


I have the input with ZD values and i want the sum all the input records and diaplay the sum at bottom through JCL.

I am getting the totals for the duplicate records only but i need to get total irrespective of the data.

Anyone please help me.


User avatar
Frank Yaeger
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA

Post by Frank Yaeger » Tue Sep 19, 2006 9:19 pm

You didn't give any details, so I can only give you a general answer.

You can use a DFSORT control statement like this to get the total of your ZD fields. For the example, I assumed your ZD field is in positions 11-15.

Code: Select all

  OUTFIL REMOVECC,                                      
The trailer record might look like this:

Code: Select all

TOTAL:    13602  
If you need more specific help, you need to give me more details such as showing the job you're using, the position and length of the ZD field, and what you want the trailer record to look like.
Frank Yaeger - DFSORT Development Team (IBM) -
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at

Post Reply


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.
Mainframe Interview questions

Other References
Mainframe Tools and others