Skip to content

Type Clause

This clause is used at the 01-level to indicate which of the seven possible types of report group is being defined.

type

where control-id is an identifier in the CONTROL(S) clause, or the word REPORT or FINAL.

Type Clause: Coding Rules

  • Write the TYPE clause at the 01-level entry only. You may omit the keywords TYPE IS. If you do not code a TYPE clause for a group, it will be assumed to be TYPE DETAIL.

  • All TYPEs of report group are optional, whatever the circumstances, but every report must have at least one body group (CONTROL HEADING, DETAIL, or CONTROL FOOTING).

  • PAGE HEADING, PAGE FOOTING and the OR PAGE phrase of CONTROL HEADING groups are allowed only if you have a PAGE LIMIT clause in the RD.

  • In the CONTROL HEADING and CONTROL FOOTING forms each control-id operand must be chosen from the list of controls in your CONTROL clause, including REPORT (or FINAL) which is always assumed present.

  • If CONTROL HEADING is coded with no control-id operand, there must not be more than one control-id in the CONTROL(S) clause. The clause is then taken to mean CONTROL HEADING FOR control-id, if there is just one control-id in the CONTROL(S) clause, or CONTROL HEADING FOR REPORT if there is no CONTROL(S) clause at all.

  • If more than one (different) control-id is coded in the CONTROL FOOTING form, the result is a set of multiple CONTROL FOOTING report groups. The control-ids need not be coded in any particular order and need not form a consecutive hierarchic sequence. For example, if the CONTROLS clause is: CONTROLS ARE STATE CITY STREET it is permissible to code: 01 TYPE CF FOR STATE, STREET., which means the same as 01 TYPE CF FOR STREET, STATE.

    If a CONTROL FOOTING is required for all levels of control, ALL may be coded instead of the exhaustive list of control-ids.

    If a DETAIL group also has the same format as some CONTROL FOOTINGs, it is usually worth the effort to define it as the lowest-level CONTROL FOOTING group, and force a lowest-level control break on each GENERATE, in order to make full use of this feature. In this case summary reporting is used (see 4.2 GENERATE statement) and each totalled value, generated by a SUM clause, will be the "total" of just a single value in the case of the lowest CONTROL FOOTING.

  • If CONTROL FOOTING is coded with no control-id operand, it is taken to mean CONTROL FOOTING FOR ALL or, CONTROL FOOTING FOR control-id , if there is just one control-id in the CONTROL(S) clause, or CONTROL FOOTING FOR REPORT if there is no CONTROL(S) clause at all.

  • In any report you may have any number of DETAIL report groups, but only one PAGE HEADING, PAGE FOOTING, REPORT HEADING, REPORT FOOTING, and each control-id may appear in only one CONTROL HEADING and only one CONTROL FOOTING group. If CONTROL FOOTING FOR ALL is coded, it must be the only CONTROL FOOTING in the report.

  • The physical order of report group descriptions is irrelevant. For example, the PAGE HEADING group need not necessarily appear before the DETAIL and PAGE FOOTING. Report writer produces them in the correct sequence according to the rules for page-fit and control break testing. However, for ease of maintenance, the order implied in the format above is recommended. Also, it is helpful if CONTROL HEADING groups are coded in major-to-minor order and CONTROL FOOTING groups in minor-to-major order, paralleling the sequence in which these groups will be presented in the report.

  • In a report with a PAGE LIMIT clause, if your group contains any absolute LINE clauses, report writer will check that each line of the group will lie within the region of the page appropriate to the TYPE of the group. Refer to the diagram of the regions of the page (see 2.9.3 PAGE LIMIT Clause: Operation). REPORT HEADING and REPORT FOOTING groups may appear anywhere on the page from the HEADING position onwards. If your group contains only relative LINE clauses, and the report has a PAGE LIMIT clause, report writer will check at compilation time that your group is not larger than the appropriate region of the page, allowing for any other groups that may share that region (that is, a REPORT HEADING appearing above the first PAGE HEADING, or a REPORT FOOTING appearing below the last PAGE FOOTING).

  • All the CONTROL HEADING groups with an OR PAGE phrase must be able to fit on the page above any other DETAIL or CONTROL HEADING group. Stated precisely: (a)each DETAIL or other CONTROL HEADING must either have only relative LINEclauses or must begin with an absolute LINE which is higher than the highestpossible line number produced by the CONTROL HEADING groups with an ORPAGE phrase, and (b) the LAST DETAIL value must be sufficient toaccommodate the largest such combination.

Type Clause: Operation

You use the TYPE clause to indicate, implicitly, where and how your group is to be produced in the report. Here is a summary of how each TYPE is handled:

  • REPORT HEADING This group will appear once, at the very start of the report. (See GENERATE Statement: Operation.)

  • PAGE HEADING This group will be produced as the first group in each page. (See LINE Clause: Operation.)

  • CONTROL HEADING This group will appear automatically at the start of each different actual value of the corresponding control. (See CONTROL clause.) If you code the OR PAGE phrase, the report group will also be triggered by a page advance.

  • DETAIL All the remaining report groups that are not of one of the other six types are of TYPE DETAIL. DETAIL groups are the only report groups that can be GENERATEd explicitly by the program. The remaining six TYPEs of report group are produced automatically whenever necessary before the DETAIL group is processed. (Note that with summary reporting , the other six TYPES are the only ones that can be produced. See GENERATE Statement: Coding Rules.)

  • CONTROL FOOTING This group will appear automatically at the end of each different actual value of the corresponding control or controls. (See CONTROL clause.)

  • PAGE FOOTING This group will be produced as the last group in each page (except on a page occupied only by a REPORT HEADING and immediately after a REPORT FOOTING). (See LINE Clause: Operation.)

  • REPORT FOOTING This group will appear once, at the very end of the report. (See TERMINATE statement.)

RH and PH together

If your report contains both a REPORT HEADING and a PAGE HEADING group, report writer will attempt to place them both in the Page Heading region of the page. If it can do this without overlap, without overflowing the region, and without violating any of the above rules, then your REPORT HEADING group will be produced on the first page of the report, above the PAGE HEADING. If the PAGE HEADING has relative LINE clauses, it begins relative to the last line of the REPORT HEADING. If, despite this, you require the REPORT HEADING to appear on a page by itself, you should code NEXT GROUP NEXT PAGE in the 01-level entry of the REPORT HEADING, to suppress this check.

If you want the REPORT HEADING to appear on the first page above the PAGE HEADING and "push it down" so that your DETAIL groups start lower on the first page than they do on the remaining pages, you should omit the FIRST DETAIL sub-clause. Your DETAIL groups will then begin on the line following the PAGE HEADING . To get extra space before your first DETAIL group, you may define a blank LINE entry at the end of your PAGE HEADING:

rh and ph together

You may also achieve the same result without using a REPORT HEADING, by including all the lines in a single PAGE HEADING and using a PRESENT AFTER REPORT clause (see PRESENT AFTER clause).

PF and RF together

If your report contains both a PAGE FOOTING and a REPORT FOOTING group, report writer will attempt to place them both in the Page Footing region of the page. If it can do this without overlap, without overflowing the region, and without violating any of the above rules, then your REPORT FOOTING group will be produced on the last page of the report, below the PAGE FOOTING. If the REPORT FOOTING has relative LINE clauses, it begins relative to the last line of the PAGE FOOTING. If, despite this, you require the REPORT FOOTING to appear on a page by itself, you should code an ON NEXT PAGE phrase in the first LINE clause of the REPORT FOOTING, to suppress this check.

The OR PAGE Phrase of the CONTROL HEADING

You may add the OR PAGE phrase after the control-id operand for TYPE CONTROL HEADING. This causes your CONTROL HEADING to be produced at the top of each page. This enables you to repeat essential "key" information after your regular PAGE HEADINGs. The precise rules of operation are as follows:

  • If your report contains any such TYPE CH groups with the OR PAGE phrase, the CONTROL HEADING group will be presented after a control break at the relevant level, exactly as when the PAGE option is not present, but in addition, the actions on page advance processing are modified as follows:

    • If a DETAIL group causes a page advance then, after the usual page advance has taken place, the CONTROL HEADING group is printed. If more than one TYPE CH group has the OR PAGE option, these CONTROL HEADING groups are printed in hierarchic order, from highest to lowest. Each CONTROL HEADING is, of course, printed on the new page, irrespective of whether or not it would fit on the previous page.

    • If a CONTROL HEADING group causes a page advance, the same action occurs as in (a) above, except that the CONTROL HEADING group that caused the page advance is output only once on the new page, whether it has the OR PAGE phrase or not.

    • If a CONTROL FOOTING group causes a page advance, the same action occurs as for a DETAIL except that no CONTROL HEADINGS below the level of the CONTROL FOOTING are printed.

  • If a group has CH FOR PAGE without a control-id, it will be treated as equivalent to CH FOR PAGE OR REPORT. The following shows the layout you might require:

    page report

    Note the following labelled points in the diagram:

    (A) Because of the OR PAGE phrases, both CH groups re-appear at the top of the pageeven though neither control has changed.

    (B) When a control break occurs and the corresponding CH group will not fit on the currentpage, it appears once only at the top of the new page, even though it has an ORPAGE phrase.

    (C) If a CF group causes a page advance, the CH groups are produced at the top of thenext page, but only those at the same level or above that of the CF group.

    The following is the report writer code required to produce this layout:

    page report

Compatibility

All aspects of the following features are unique to new Report Writer:

  • Allowing the TYPE keyword to be omitted,
  • The optional words ON and FOR,
  • The OR PAGE phrase of CONTROL HEADING,
  • Default of DETAIL if the TYPE clause is omitted.
  • The multiple CONTROL FOOTING option.
Back to top