Kolusu, this works great, and the end user is happy with the detail.
Now, he wants one additional tweak. The top of the file (within the
first two rows) has this:
PROD.A31XAD.IDARTA00 ARTICLE LISTING BY
DEPARTMENT
(This starts in Col 2) (This
starts in Col 56)
I managed to include this file name by pushing it onto the unneeded area
in every row like this:
INREC IFTHEN=(WHEN=GROUP,BEGIN=(56,15,CH,EQ,C'ARTICLE LISTING'),
PUSH=(30:2,44))
and then I could include it in a Header1 clause. However, if there are
no "L" records in the file, there is no file name in col 30 to use. Is
there some other way I can capture this filename from the first or
second row, and then use it in my OUTFIL Header1 clause even if there
are no detail records to Count or Tot?
Billy
------ Original Message ------
From "Sri h Kolusu" <skol...@us.ibm.com>
To IBM-MAIN@listserv.ua.edu
Date 3/27/2023 12:29:22 PM
Subject Re: DFSORT to count and sum subsets of data
What I want to do is produce a single line for each Department (cols 1-3), that tells me
the number of articles (Count of all rows with a numeric value in cols 19-21, and an
Indicator in col 22 of "D"), and a sum of the Counter (cols 102-110, pic
999999999), with a grand total. It will look like this:
Billy,
It is quite simple. Use the following control cards.
//SYSIN DD *
INCLUDE COND=(22,01,CH,EQ,C'D')
SORT FIELDS=(01,03,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(01,03,
TRAILER3=(' DEPARTMENT ',
01,03,
COUNT=(M10,LENGTH=8),
' ARTICLES, TOTAL ITEMS: ',
TOT=(102,09,UFF,M10,LENGTH=12))),
TRAILER1=('*** TOTAL *** : ',
COUNT=(M10,LENGTH=8),
' ARTICLES, TOTAL ITEMS: ',
TOT=(102,09,UFF,M10,LENGTH=12))
/*
If you do need to validate the contents of 19-21 for numeric , then you just
need to use the following control cards. Just add an IFTHEN statement for
numeric check.
//SYSIN DD *
INCLUDE COND=(22,01,CH,EQ,C'D')
INREC IFTHEN=(WHEN=(19,3,FS,EQ,NUM),
OVERLAY=(130:C'1'))
SORT FIELDS=(01,03,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(01,03,
TRAILER3=(' DEPARTMENT ',
01,03,
TOT=(130,01,ZD,M10,LENGTH=8),
' ARTICLES, TOTAL ITEMS: ',
TOT=(102,09,UFF,M10,LENGTH=12))),
TRAILER1=('*** TOTAL *** : ',
TOT=(130,01,ZD,M10,LENGTH=8),
' ARTICLES, TOTAL ITEMS: ',
TOT=(102,09,UFF,M10,LENGTH=12))
/*
If you intend to have the spaces trimmed in the output, let me know and I will
suggest an alternative.
Thanks,
Kolusu
DFSORT Development
IBM Corporation
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN