View previous topic :: View next topic
Author
Message
Lynne New User Joined: 15 Jan 2015Posts: 98 Location: USA
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
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2117 Location: USA
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
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1305 Location: Bamberg, Germany
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
Lynne New User Joined: 15 Jan 2015Posts: 98 Location: USA
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
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1305 Location: Bamberg, Germany
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
Please enable JavaScript!