[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
Reference Manual


Previous Contents Index

Additional Reference

Section 5.2.3, Additional Alignment Rules for Record Allocation

5.3.50 TYPE

Function

The TYPE clause identifies the report group type and indicates when the Report Writer Control System (RWCS) is to process it.


control-head-name

names a control-name in the CONTROL clause.

control-foot-name

names a control-name in the CONTROL clause.

Syntax Rules

  1. RH is an abbreviation for REPORT HEADING.
    PH is an abbreviation for PAGE HEADING.
    CH is an abbreviation for CONTROL HEADING.
    DE is an abbreviation for DETAIL.
    CF is an abbreviation for CONTROL FOOTING.
    PF is an abbreviation for PAGE FOOTING.
    RF is an abbreviation for REPORT FOOTING.
  2. These report groups may appear no more than once in the description of a report:
    • REPORT HEADING
    • PAGE HEADING
    • CONTROL HEADING FINAL
    • CONTROL FOOTING FINAL
    • PAGE FOOTING
    • REPORT FOOTING
  3. The TYPE DETAIL report group may appear more than once in the description of a report.
  4. If the TYPE clause specifies a CONTROL HEADING or CONTROL FOOTING report group, the control-head-name, control-foot-name, or FINAL entries must be specified in the CONTROL clause of the corresponding Report Description entry. For each control-name or FINAL phrase in the CONTROL clause of a Report Description entry, you can specify one CONTROL HEADING report group and one CONTROL FOOTING report group. However, the RWCS does not require either a CONTROL HEADING report group or a CONTROL FOOTING report group for each control-name or FINAL phrase in the CONTROL clause of a Report Description.
  5. PAGE HEADING and PAGE FOOTING report groups may appear only if the corresponding Report Description entry specifies a PAGE clause.
  6. In CONTROL FOOTING, PAGE HEADING, PAGE FOOTING, and REPORT FOOTING report groups, SOURCE clauses and USE statements must not reference any of the following:
    • Formats 2 and 3 Report Group Description data items containing a control data item
    • Data items subordinate to a control data item
    • A redefinition or renaming of any part of a control data item
  7. In PAGE HEADING and PAGE FOOTING report groups, SOURCE clauses and USE statements must not reference either control-head-name or control-foot-name.
  8. When the Procedure Division specifies a GENERATE report-name statement, the corresponding Report Description entry must define no more than one DETAIL report group. If there are no GENERATE group-data-name statements in the Procedure Division, the RWCS does not require a DETAIL report group. If there are multiple TYPE DETAIL report groups in the report, the GENERATE group-data-name statement must be used.

General Rules

  1. The Report Writer Control System (RWCS) processes DETAIL report groups as a direct result of the GENERATE statement. If a report group specified in the GENERATE statement is not a TYPE DETAIL report group, a summary report is produced. If a report group specified in the GENERATE statement is a TYPE DETAIL report group, a detailed report is produced.
  2. The RWCS executes the following procedures (a to f) when it processes a DETAIL report group in response to a GENERATE statement.
    When the description of a report includes exactly one DETAIL report group, the detail-related processing that the RWCS executes in response to a GENERATE report-name statement is described in procedures a to d. The RWCS performs these procedures as though a GENERATE group-data-name statement were being executed.
    When the description of a report includes no DETAIL report groups, the detail-related processing that the RWCS executes in response to a GENERATE report-name statement is described in procedures a and b. These procedures are performed as though the description of the report included exactly one DETAIL report group, and a GENERATE detail-report-group statement were being executed.
    1. The RWCS performs any control break processing.
    2. The RWCS performs any subtotalling that has been designated for the DETAIL report group.
    3. If there is a USE BEFORE REPORTING procedure referring to the data-name of the report group, the RWCS executes the USE procedure.
    4. If a SUPPRESS statement has been executed, or if the report group is not printable, no further processing is done for the report group.
    5. If the RWCS processes a DETAIL report group as a consequence of the GENERATE report-name statement, no further processing is done for the report group.
    6. If neither procedure d nor procedure e applies, the RWCS formats the print lines and presents the DETAIL report group.
  3. To detect and trigger control breaks for a specific report, the RWCS:
    1. Establishes the initial values of control data items as the prior values when the INITIATE statement executes.
    2. Compares the prior values to the current values of control data items when a GENERATE statement executes. If the current values do not compare to the prior values, a control break occurs. If a control break occurs, the current values are saved as prior values and steps c, d, and e are performed.
    3. Presents the CONTROL FOOTING and CONTROL HEADING report groups associated with the control break. The CONTROL FOOTING report groups presented are at a less major level than the level at which the control break occurred. The CONTROL HEADING report groups presented are in the order of major level to break level.
    4. Processes any PAGE HEADING and PAGE FOOTING report groups when it must start a new page to present a CONTROL HEADING, DETAIL, or CONTROL FOOTING.
    5. Repeats steps b, c, and d until the last control break is processed.
  4. The prior values (refer to General Rule 3) may be referenced by the program:
    • During the control break processing of a CONTROL FOOTING report group. Any references to control data items in a USE procedure or SOURCE clause associated with that CONTROL FOOTING report group are supplied with prior values.
    • When a TERMINATE statement executes. The RWCS makes the prior values available to the SOURCE clause or the USE procedure references in CONTROL FOOTING report groups as though the control break had been detected in the highest control data-name.
    • At the time the RWCS processes the report group. All other data item references within report groups and their USE procedures access the current values contained within the data items.
  5. The RWCS presents the REPORT HEADING report group only once for each report, as the first report group of that report. It is processed when the first GENERATE statement is executed.
  6. The RWCS presents the PAGE HEADING report group as the first report group on each page of the report, except for the following conditions:
    • A page containing only a REPORT HEADING report group.
    • A page containing only a REPORT FOOTING report group.
    • A page containing a REPORT HEADING report group that is not the only report group on the page. In this case, the PAGE HEADING report group is the second report group on the page.
  7. The RWCS processes the CONTROL HEADING report group at the end of a control break for a specific control-head-name.
    The CONTROL HEADING FINAL report group is presented only once for each report, as the first body group (CONTROL HEADING, DETAIL, and CONTROL FOOTING) of that report. Other CONTROL HEADING report groups are presented when the RWCS detects a control break on the control-head-name during the execution of GENERATE statements. Control break processing for any CONTROL HEADING report group occurs with the highest control level of the break and includes all lower levels.
  8. The RWCS presents CONTROL FOOTING report group at the beginning of a control break for a specific control-foot-name.
    The CONTROL FOOTING FINAL report group is presented only once for each report, as the last body group (CONTROL HEADING, DETAIL, and CONTROL FOOTING) of that report. If, during the execution of a GENERATE statement, the RWCS detects a control break, control break processing for any CONTROL FOOTING report group occurs with the highest control level of the break and includes all lower levels. Upon execution of the TERMINATE statement, the RWCS processes all CONTROL FOOTING report groups if the GENERATE statement has executed at least once.
  9. The RWCS processes the PAGE FOOTING report group as the last report group on each page of the report, except for the following conditions:
    • A page containing only a REPORT HEADING report group.
    • A page containing only a REPORT FOOTING report group.
    • A page containing a REPORT FOOTING report group that is not to be the only report group on the page. In this case, the PAGE FOOTING report group is the second to the last report group on the page.
  10. The RWCS processes the REPORT FOOTING report group, if defined, only once per report and as the last report group of that report. During the execution of a TERMINATE statement, the RWCS processes the corresponding REPORT FOOTING report group if at least one GENERATE statement is executed for the report.
  11. The RWCS checks for these three conditions before it processes a REPORT HEADING, PAGE HEADING, CONTROL HEADING, PAGE FOOTING, or a REPORT FOOTING report group:
    • If there is a USE BEFORE REPORTING procedure referencing the data-name of the report group, the USE procedure executes.
    • If a SUPPRESS statement has been executed, or if the report group is not printable, there is no further processing for the report group.
    • If a SUPPRESS statement has not been executed and the report group is printable, the RWCS formats the print lines and presents the report group according to the presentation rules for that type of report group.
  12. The RWCS executes the following procedures when it processes a CONTROL FOOTING report group.
    Control breaks occur during the processing of a GENERATE statement. The GENERATE rules specify that the RWCS produces the CONTROL FOOTING report groups beginning at the minor level, and proceeding upwards, through and including the highest control level. Although no CONTROL FOOTING report group has been defined for a given control data-name, the RWCS will still have to execute procedure 12f if a RESET phrase within the report description specifies that control data-name.
    1. Sum counters are crossfooted. All sum counters defined in this report group that are operands of SUM clauses in the same report group are added to their sum counters.
    2. Sum counters are rolled forward. All sum counters defined in the report group that are operands of SUM clauses in higher level CONTROL FOOTING report groups are added to the higher level sum counters.
    3. If there is a USE BEFORE REPORTING group-data-name declarative procedure, the RWCS executes the USE procedure.
    4. If a SUPPRESS statement has been executed, or if the report group is not printable, the RWCS executes procedure 12f.
    5. If a suppress statement has not been executed and the report group is printable, the RWCS formats the print lines and presents the report group according to the presentation rules for CONTROL FOOTING report groups.
    6. The RWCS resets those sum counters that are to be reset when the RWCS processes this level in the control hierarchy.


Previous Next Contents Index