getting subtotals for multiple sections

Author Message
Lynne

New User

Joined: 15 Jan 2015
Posts: 98
Location: USA

Posted: Sat Jun 17, 2023 9:34 am

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

Senior Member

Joined: 29 Apr 2008
Posts: 2117
Location: USA

Posted: Sat Jun 17, 2023 6:26 pm

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

Senior Member

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

Posted: Sun Jun 18, 2023 10:21 am

 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 **********
Lynne

New User

Joined: 15 Jan 2015
Posts: 98
Location: USA

 Posted: Mon Jun 19, 2023 3:25 am 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.
Joerg.Findeisen

Senior Member

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

Posted: Mon Jun 19, 2023 10:42 am

 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.
 View Bookmarks All times are GMT + 6 Hours

 Topic Forum Replies Similar Topics SORT JCL to merge multiple tow into s... DFSORT/ICETOOL 6 Using Multiple IFTHEN and WHEN condit... SYNCSORT 12 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12 Multiple table unload using INZUTILB DB2 2
Search our Forums:

 IBMMainframes.com is not an official and/or affiliated with IBM® in anyway Board Rules | FAQ | Downloads | Wiki | SiteMap | Contact Us