Printing sectioned reports

The previous tutorial showed you how to print tailored reports using the DISPLAY operator. By using the BREAK operand of DISPLAY, you can create reports divided into sections by a character or numeric break field on which you have previously sorted. You can use formatting items with BREAK(p,m,f,formatting) in the same way you can use them with ON(p,m,f,formatting). You can also specify a string for the break title (BTITLE operand) and statistics for the individual sections (BTOTAL, BAVERAGE, BMAXIMUM, BMINIMUM and BCOUNT operands). EDBCOUNT(formatting) can be used to specify formatting items for BCOUNT.

For this example, we will use the data set with books from publishers VALD and WETH, sorted by publisher and title, that we created previously. To print a report with sections by publisher showing the title and price fields with a title line, field headings, break title, break averages and totals, and overall averages and totals, write the following DISPLAY operator: Printing a report with sections by publisher showing the title and price fields with a title line, field headings, break title, break averages and totals, and overall averages and totals

DAPUBS is the ddname for the previously created VALD and WETH data set. SECTIONS is the ddname for the list data set in which you want the report to be printed.

TITLE and PAGE indicate the elements to be included in the title line and their placement.

Each HEADER and ON pair indicate a field to be included in the report and the heading to be used for it.

BTITLE indicates a string to be used for the break title and its placement (before or after the break field). BREAK indicates the break field to be used to create sections. BAVERAGE and BTOTAL indicate section statistics to be produced at the end of each section.

AVERAGE and TOTAL indicate overall statistics to be produced at the end of the report.

Because SECTIONS has not been defined previously, you must add a JCL statement for it at the end of the job:

//SECTIONS DD SYSOUT=A

When this DISPLAY operator is run, it produces a three-page report for the SECTIONS data set that looks like this:

BOOKS FOR INDIVIDUAL PUBLISHERS        - 1 -

PUBLISHER:  VALD

TITLE OF BOOK                                  PRICE OF BOOK
-----------------------------------   ----------------------
CELLS AND HOW THEY WORK                               $24.95
COMPLETE SPANISH DICTIONARY                            $6.50
EDITING SOFTWARE MANUALS                              $14.50
FREUD'S THEORIES                                      $12.50
INTRODUCTION TO BIOLOGY                               $23.50
NOVEL IDEAS                                           $24.50
SHORT STORIES AND TALL TALES                          $15.20
STRATEGIC MARKETING                                   $23.50
VIDEO GAME DESIGN                                     $21.99
ZEN BUSINESS                                          $12.00

AVERAGE FOR THIS PUBLISHER                            $17.91

TOTAL FOR THIS PUBLISHER                             $179.14
BOOKS FOR INDIVIDUAL PUBLISHERS        - 2 -

PUBLISHER:  WETH

TITLE OF BOOK                                  PRICE OF BOOK
-----------------------------------   ----------------------
ANTICIPATING THE MARKET                               $20.00
CIVILIZATION SINCE ROME FELL                          $13.50
COMPUTERS: AN INTRODUCTION                            $18.99
EIGHTEENTH CENTURY EUROPE                             $17.90
GUIDE TO COLLEGE LIFE                                 $20.00
GUNTHER'S GERMAN DICTIONARY                           $10.88
REBIRTH FROM ITALY                                    $25.60
SYSTEM PROGRAMMING                                    $31.95
THE INDUSTRIAL REVOLUTION                              $7.95

AVERAGE FOR THIS PUBLISHER                            $18.53

TOTAL FOR THIS PUBLISHER                             $166.77
BOOKS FOR INDIVIDUAL PUBLISHERS        - 3 -

TITLE OF BOOK                                  PRICE OF BOOK
-----------------------------------   ----------------------

AVERAGE FOR ALL PUBLISHERS                            $18.20

TOTAL FOR ALL PUBLISHERS                             $345.91
So far
You have now learned how to print simple, tailored and sectioned reports using ICETOOL's DISPLAY operator. Next, you will learn about ICETOOL's OCCUR operator.