>> 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 [email protected] with the message: INFO IBM-MAIN

Reply via email to