You can use DFSORT for creating an excellent reports. The headers are HEADER1,HEADER2 and HEADER3. Also you can give trailers TRAILER1, TRAILER2 parameters and TRAILER3.
Let you specify multi-line headings with character strings, hexadecimal strings, input fields, the current date, the current time, page numbers and blank lines. In addition, you can include edited or converted record counts, and edited or converted totals, maximums, minimums, and averages for numeric fields, in your trailers.
The following statements create a report with a separate report trailer page containing the overall record count and various overall statistics for the revenue brought in by the branches.
The character ‘/’ says skip that line -meaning.
//SYSIN DD * SORT FIELDS=(1,15,CH,A) OUTFIL FNAMES=RPT4, HEADER2=(1:'BRANCH',18:'REVENUE',28:'PROFIT'), OUTREC=(1,15,X, 22,6,PD,EDIT=(SIII,IIT),SIGNS=(,-),X, 28,6,PD,EDIT=(SIII,IIT),SIGNS=(,-), 50:X), TRAILER1=(2/, 3:'Overall results for branches on ',DATE=(MD4/),':',2/, 3:COUNT=(EDIT=(IIT)),' branches are included',2/, 5:'Total revenue = ', TOT=(22,6,PD,M12,LENGTH=10),/, 5:'Average revenue = ', AVG=(22,6,PD,M12,LENGTH=10),/, 5:'Lowest revenue = ', MIN=(22,6,PD,M12,LENGTH=10),/, 5:'Highest revenue = ', MAX=(22,6,PD,M12,LENGTH=10))
You would use TRAILER1 when you want a report trailer to appear by itself as the last page of the report. This is also handy for creating one record with a count or date.
You would use TRAILER2 when you want a page trailer to appear at the bottom of each page of the report.
You would use TRAILER3 within SECTIONs when you want a section trailer to appear after the last data record of each section.