Hey everyone - happy Monday!

I am trying to come up with a single SORT step to give me counts and a sum of a field on subsets of data, and using control breaks. Here is a sample of my input with lines shortened for the email:

A01DDATE 001D<< Cols 23 to 101 MISCELLANEOUS DATA >> 10 2 A01DDATE 001W<< Cols 23 to 101 MISCELLANEOUS DATA >> 93 2 A01MEXTRA 047D<< Cols 23 to 101 MISCELLANEOUS DATA >> 3 2 A01MEXTRA 022P<< Cols 23 to 101 MISCELLANEOUS DATA >> 5 2 A01MEXTRA 019R<< Cols 23 to 101 MISCELLANEOUS DATA >> 35 2 A02QTRAN 103D<< Cols 23 to 101 MISCELLANEOUS DATA >> 802 2 A02QTRAN 014R<< Cols 23 to 101 MISCELLANEOUS DATA >> 9 2 A02QTRAN 012T<< Cols 23 to 101 MISCELLANEOUS DATA >> 41 2 A02QTRAN 083V<< Cols 23 to 101 MISCELLANEOUS DATA >> 12 2 A02ZHORIZ 023D<< Cols 23 to 101 MISCELLANEOUS DATA >> 456 2 A02ZHORIZ 011P<< Cols 23 to 101 MISCELLANEOUS DATA >> 81 2 A02ZVERTICAL 011D<< Cols 23 to 101 MISCELLANEOUS DATA >> 773 2 A02ZVERTICAL 003M<< Cols 23 to 101 MISCELLANEOUS DATA >> 1 2

This is the layout:
  1 - len  3, Dept
 19 - len  3, numeric
 22 - len  1, Indicator
 23 - len 77, miscellaneous
102 - len  9, Counter
111 - len 19, miscellaneous

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:

Department A01: 2 articles, total items: 13 (# = suppressed zeros)
Department A02: ######3 articles, total items: #######2031
*** TOTAL *** : ######5 articles, total items: #######2044

I can get the count to work through a simple sum, but I can't get the number of articles to break on the Department code (there could be 1-to-n departments in each file).

Can someone help me with what should be fairly simple here?

Thank you and best regards,
Billy Ashton

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to