Report Section [ Micro Focus COBOL Language Reference - Additional Topics ] MPE/iX 5.0 Documentation
Micro Focus COBOL Language Reference - Additional Topics
Report Section
The Report Section of a COBOL Data Division contains one or more Report
Description entries (RD entries), each of which forms the complete
description of a report.
The report named in the RD entry is not assigned directly to an output
file. Instead, it is associated with a file-name in the File Section and
that file-name is associated with a file when an OPEN statement
specifying the file-name is executed. More than one report can be
associated with the same file-name and the CODE clause is used to
differentiate among the reports. For an external file connector
referenced by a file-name, separately compiled programs can specify
different reports for the same file-name. This file description entry
must specify the name of a report description entry for each report
associated with that file-name in this program.
The RD entry contains a set of clauses that names the report and supplies
specific information about the format of the printed page and the
organization of the subdivisions of the report. An identification code
can be given in the RD entry so that each report can be identified
separately in an intermediate output file.
Following each RD entry are one or more 01 level-number entries, each
followed by a hierarchical structure similar to COBOL record
descriptions. Each 01 level-number entry and its subordinate entries
describes a report group. Each report group consists of one or more
print lines that are regarded as a unit. A report group that is to be
printed is printed entirely on one logical page; it is never split across
pages.
Report Structure
When structuring a report, major consideration must be given to vertical
and horizontal spacing requirements, manipulation of data, and the
physical and logical subdivisions of a report.
Vertical Spacing.
The Report Writer feature allows the user to describe report groups
containing multiple lines. The vertical positioning of the lines on a
page is specified by the LINE NUMBER clause that is associated with each
line. The NEXT GROUP clause indicates how many lines to space after
presenting the last line of the group. The first LINE NUMBER clause of
the next group indicates additional spacing information to be used in
positioning of that group.
Horizontal Spacing.
The Report Writer allows the user to position the fields of data on a
report line by means of the COLUMN NUMBER clause. The RWCS supplies
space fill between all defined fields.
Data Manipulation.
When the Report Writer feature is used, data movement to a report group
is directed by report section clauses rather than Procedure Division
statements. The report section clauses that affect the manipulation of
data are the SOURCE, SUM, and VALUE clauses.
The SOURCE clause specifies the sending data item of an implicit MOVE
statement. The receiving printable item is defined by the description of
the report group item in which the SOURCE clause appears.
The SUM clause automatically causes the establishment of a sum counter.
The object of the SUM clause names the data item(s) which are added to
the sum counter when a GENERATE statement is executed. The moving of the
sum counter contents to the receiving printable item, defined by the
description of the report group item in which the SUM clause appears, is
accomplished automatically when that report group is presented.
The VALUE clause defines a literal that appears in the printable item of
a report group each time that report group is to be presented.
In summary, a data item in a report group is presented only if it has a
COLUMN NUMBER clause specifying where it is to be presented. The value
that is placed in a printable item is determined by the SOURCE, SUM, or
VALUE clause stated in the report group description. Under no
circumstances can a report group printable item receive a value directly
via a Procedure Division statement.
Report Subdivisions
The physical and logical organization of a report interact to determine
what is presented on a page.
Physical Subdivision of a Report.
The PAGE clause specifies the length of the page, the size of the heading
and footing areas, and the size of the area in which the detail lines
will appear. The RWCS uses the LINE NUMBER and NEXT GROUP clauses to
position these report groups, and when necessary, to advance to a new
page with automatic production of PAGE HEADING and PAGE FOOTING report
groups.
Logical Subdivisions of a Report.
DETAIL report groups can be structured into a nested set of control
groups. Each control group can begin with a CONTROL HEADING report group
and end with a CONTROL FOOTING report group.
When nested control groups are defined, the recognition of a change in
value of a control data item in a control hierarchy is called a control
break and the heading and footing lines associated with the control
data-name are called CONTROL HEADING and CONTROL FOOTING report groups.
During the execution of a GENERATE statement, the RWCS uses the control
hierarchy to check automatically for control breaks. If a control break
has occurred, all controls that are minor to it are considered to have
changed, even though they may not in fact have changed. The occurrence
of a control break causes the following sequence of events to take place:
1. ALL CONTROL FOOTING report groups are presented up to and
including the one at the level at which the control break
occurred.
2. ALL CONTROL HEADING report groups are presented from the control
break level down to the most minor control.
3. The DETAIL report group named in the GENERATE statement is
presented.
Procedure Division Report Writer Statements.
The Report Writer statements that appear in the Procedure Division are:
INITIATE, GENERATE, TERMINATE, SUPPRESS, and USE BEFORE REPORTING.
The INITIATE statement causes the RWCS to perform automatically a number
of initialization functions. A report must be initiated before any
detail processing can take place.
The GENERATE statement which specifies a data-name causes the named
DETAIL report group to be formatted and written to the output device. In
addition, it triggers the RWCS to perform the many implicit actions
described in the preceding section.
The GENERATE statement which specifies a report-name provides a means of
summary reporting. A report produced by this type of statement has all
detail print lines suppressed automatically and consists of only the
summary totals accumulated during the processing of the DETAIL report
group. The RWCS processing for a GENERATE report-name statement is
identical to that which occurs for a GENERATE data-name statement, except
that the former results in the suppression of detail print lines.
The TERMINATE statement causes the RWCS to perform all of the automatic
functions associated with the termination of a report. The TERMINATE
statement must be executed before the file containing the report is
closed.
The SUPPRESS statement provides the object time facility to suppress the
printing of an entire report group.
The BEFORE REPORTING phrase of the USE statement provides a mechanism
whereby Procedure Division statement can be executed at specific
instances in the automatic procedures performed by the RWCS. The
statements in the USE BEFORE REPORTING procedure can alter the contents
of the data items that are referenced by SOURCE clauses. Thus control is
possible over the contents of data items referenced in report groups that
are produced automatically.
MPE/iX 5.0 Documentation