INREC statement - copies input positions 1-40 and adds a PD value of 1 in positions 41-44. The PD value of 1 is being used as a counter.
SORT - sorts on the key which is the PD value in positions 5-8.
SUM - for each key value, keeps one record and adds up the counter to get the count of records for that key. So you end up with one record per key containing the count of records with that key.
OUTREC - converts the key value to a printable value in the form IIIITS with leading zeros suppressed and a trailing sign of blank or - (for example, '1234 ' or ' 1-'. Converts the counter to a printable value in the same form.
For example, if the input records had:
The output would be
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from: