Previous topic |
Next topic |
Contact z/OS |
z/OS DFSORT: Getting Started
The preceding output for RPT2 does not look much like a report, but you can fix that by adding page headings with OUTFIL's HEADER2 parameter. This parameter (as well as the HEADER1 and HEADER3 parameters discussed later), lets you specify multi-line headings with character strings, hexadecimal strings, input fields, the current date, the current time, page numbers and blank lines.
The following statements create a report with page headings:
All of the elements in the HEADER2 parameter should be familiar from the previous discussions of the OUTREC statement, except for the PAGE and DATE=(MD4-) parameters.
PAGE tells DFSORT to print a 6-character page number with leading blanks starting at 1 for the first page and incrementing by 1 for each subsequent page. For page 3, PAGE would give you ' 3'. If you wanted to print a 3-character page number with leading zeros, you could use PAGE=(EDIT=(TTT)) or PAGE=(M11,LENGTH=3) or PAGE=(TO=ZD,LENGTH=3). For page 10, these would all give you '010'. See Converting numeric fields to different formats and Editing numeric fields, for more information on conversion and editing.
DATE=(MD4-) tells DFSORT to print the date in the form mm-dd-yyyy. See z/OS DFSORT Application Programming Guidez/OS DFSORT Application Programming Guide for more information on the different forms of the date you can print in headers and trailers.
You do not need to start character strings in headers (HEADERn parameters) or trailers (TRAILERn parameters) with C as you do for the BUILD, OUTREC, OVERLAY, FINDREP, or IFTHEN parameters, although you can if you want to.
If n/ is used at the start or end of a header or trailer, n blank lines are printed. If n/ is used in the middle of a header or trailer, n-1 blanks lines are printed.
The following is a two-page result produced for RPT3:
If you print this report, the ANSI carriage control characters tell the printer to eject a page when it sees '1' in the first byte, and to insert a blank line before the lines with '0' in the first byte. So you get a blank line between the 'Branch Revenue Report" line and the "Branch" line in your headers, corresponding to the 2/ in your OUTREC parameter. However, if you view this report on a display, the ANSI carriage control characters are ignored, so the '0' line does not have a blank line before it on the display. To force the blank line to appear whether you print the report or view it on a display, you can change the second line of HEADER2 to:
This forces DFSORT to write an additional blank output line instead of using the '0' ANSI carriage control character to insert a blank line for the printer. The blank line appears on the printer or display.
OUTFIL's HEADER1 parameter is very similar to the HEADER2 parameter, except that it produces a report heading on a separate page before the first page of data. You can add the following HEADER1 parameter to your OUTFIL statement:
This separate page is printed at the beginning of the report for RPT3, before the other two pages shown previously. Thus, the first two pages of the report would start like this:
Note that the report heading only has a few lines and then we eject to a new page for the first page heading. If we wanted to start the page heading on the same page as the report heading, we could use OUTFIL's BLKCCH2 parameter. This parameter tells DFSORT to replace the '1' in the first line of the first page heading with a blank, thus avoiding the page eject. With BLKCCH2, the first page of the report would start like this:
You can also use OUTFIL's BLKCCH1 parameter to tell DFSORT to replace the '1' in the first line of the report heading with a blank, thus avoiding the page eject for the report heading.
Here are sample JCL statements and control statements for the report using HEADER1, HEADER2, and BLKCCH2:
Of course, you could use a temporary or permanent data set for RPT3 instead of SYSOUT=A. For example:
Copyright IBM Corporation 1990, 2014