IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

getting subtotals for multiple sections


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Lynne

New User


Joined: 15 Jan 2015
Posts: 98
Location: USA

PostPosted: Sat Jun 17, 2023 9:34 am
Reply with quote

I have created reports with counts for data where I am able to sort/break the data into sections of one level using count and subtotals.

but if I have sections with 2 levels, how do it get totals for both levels as well as a grand total?

my syncsort code is this:
Code:
*
* JUST OUTPUT COUNTS FOR EACH UPDATE CYC RANGE WITH
*  INPUT CYCLE BEFORE MISSING CYCLES
*
  OUTFIL FILES=0U,                           INITIAL CYCLE
         INCLUDE=((93,6,CH,GT,87,6,CH),AND,   INIT CYCLE
                  (87,6,CH,LT,C'&C1')),
         SECTIONS=(93,6,87,6,                UPDATE  CYCLE
                   TRAILER3=(COUNT,'  ',
                             87,6,'-',93,6)),
         NODETAIL,                          SKIP DETAILS
         TRAILER1(/,
                  1:'H',
                  4:'COUNT',
                 11:'INIT',
                 18:'UPD',
                 //,'TOTAL UPD RECS - INIT CYC B4 202127',SUBCOUNT)


right now, my output looks like this:

Code:
        2  202012-202127
        1  202018-202127
        2  202019-202127
        3  202033-202127
       55  202005-202139
       50  202005-202201
1
 H  COUNT  INIT   UPD

 TOTAL UPD RECS - INIT CYC B4 202127     113


I would like to add subtotals for the 2nd section (87,6), so it looks like this:

Code:
        2  202012-202127
        1  202018-202127
        2  202019-202127
        3  202033-202127
     [color=blue]   8  <- subtotal  for 202127[/color]

       55  202005-202139
     [color=blue]  55  <- subtotal  for 202139[/color]

       50  202005-202201
       [color=blue]50  <- subtotal  for 202201[/color]
1
 H  COUNT  INIT   UPD

 TOTAL UPD RECS - INIT CYC B4 202127     113

[/code]

I've looked at the syncsort manual - the explanation for iftrail was - unintelligable with no examples - the ibm dfsort was better described.. but I still can't figure it out. not even sure if IFTRAIL would help me anyway.

If anyone has an example of doing this, I would appreciate it.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2050
Location: USA

PostPosted: Sat Jun 17, 2023 6:26 pm
Reply with quote

Parameter SECTIONS= can optionally define more than one level of breaks.
Code:
. . . SECTIONS=(87,6,level1_parameters,
                93,6,level2_parameters), . . .

(not sure about the order of levels).
Try to experiment with them.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1280
Location: Bamberg, Germany

PostPosted: Sun Jun 18, 2023 10:21 am
Reply with quote

Code:
202012-202127
202012-202127
202018-202127
202019-202127
202019-202127
202033-202127
202033-202127
202033-202127
202005-202139
202005-202139
202005-202139
202005-202139
202005-202139
202005-202139
202005-202139
202005-202139
202005-202139
:

Code:
  OPTION COPY                                               
  OUTFIL FNAMES=(SORTOUT),
  INCLUDE=(...), * put your selection criteria in here                                   
  NODETAIL,                                                 
  SECTIONS=(8,6,                                           
    TRAILER3=(COUNT,X,C'<- subtotal for ',8,6),             
            1,13,                                           
    TRAILER3=(COUNT,X,1,6,C'-',8,6)),                       
  TRAILER1(/,                                               
           1:'H',                                           
           4:'COUNT',                                       
           11:'INIT',                                       
           18:'UPD',                                       
           /,/,'TOTAL UPD RECS - INIT CYC B4 202127',COUNT) 
  END

Code:
****** **************************** Datenanfang ********
000001 1       2 202012-202127                         
000002         1 202018-202127                         
000003         2 202019-202127                         
000004         3 202033-202127                         
000005         8 <- subtotal for 202127                 
000006        55 202005-202139                         
000007        55 <- subtotal for 202139                 
000008        50 202005-202201                         
000009        50 <- subtotal for 202201                 
000010 1                                               
000011  H  COUNT  INIT   UPD                           
000012
000013  TOTAL UPD RECS - INIT CYC B4 202127     113     
****** **************************** Datenende **********
Back to top
View user's profile Send private message
Lynne

New User


Joined: 15 Jan 2015
Posts: 98
Location: USA

PostPosted: Mon Jun 19, 2023 3:25 am
Reply with quote

thank you. I don't know why I didn't realize you could specify a trailer3 for each subsection. I was thinking 1 per report.

Thanks so much. Kind of obvious now that I reread that part of the manual.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1280
Location: Bamberg, Germany

PostPosted: Mon Jun 19, 2023 10:42 am
Reply with quote

Lynne wrote:
I don't know why I didn't realize you could specify a trailer3 for each subsection. I was thinking 1 per report.

It is not so common to have it as per your requirement.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top