Addition of Amounts using Sort JCL

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
hyeamit
Member
Posts: 2
Joined: Mon Dec 23, 2013 10:54 am

Addition of Amounts using Sort JCL

Post by hyeamit » Mon Dec 23, 2013 11:02 am

Hi All,

We have a requirement where we need to add the amounts according to the Country and accounting months.
E.g.

Input
C1 01 10.00
C1 01 10.00
C1 02 50.00
C1 02 50.00
C1 03 70.00
C1 03 70.00
C2 01 20.00
C2 01 20.00
C2 02 30.00
C2 02 30.00

Output:
C1 01 20.00 <-- Additing of amount for accounting month 01
C1 02 120.00 <--- Addition of amount for Accounting Month 01 and 02
C1 03 260.00 <--- Addition of amount for Accounting Month 01,02,03
C2 01 40.00
C2 02 100.00

We can easily sum up the amount as per Accounting month but the problem is to sum up amount for the current month with the all old accounting months.

Not sure if it is possible through JCL. Any help is very much appriciated.

Thanks in advance

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

Post by William Collins » Mon Dec 23, 2013 12:06 pm

Are you saying you need cumulative figures by month? Can you check the fiigures in your example output?

hyeamit
Member
Posts: 2
Joined: Mon Dec 23, 2013 10:54 am

Post by hyeamit » Mon Dec 23, 2013 12:13 pm

Yes William, I need the Cumulative figure by month,
But it should be like for 02 month the sum will Cumulative sum of 01 + Cumulative sum of 02.
For Month 03 the sum will Cumulative sum of 01 + Cumulative sum of 02 + Cumulative sum of 03. Like wise
I checked the figures in the example are correct as per the above criteria.
Not sure, if i am clear this time.

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Mon Dec 23, 2013 10:40 pm

Please not that "sort JCL" cannot do this. It can only tell the os that you want to run sort and it needs the resources specified in the JCL. Also note that there is a sort section of the forum (titled DFsor but is for all sort products).

You need to specify which sort product you are using as the sort control cards required may differ depending on the sort product.
Regards
Nic

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