Module 3: QMF Reports and Forms
QMF- Reports and Forms
Running a query gives you rows; a form turns those rows into a report people actually want to read. The form controls column headings, widths, alignment, page headers, control breaks, and totals — and it is a saved object you can reuse on any query with matching columns.
What a form does
- After RUN QUERY, QMF formats the REPORT panel using the current form — by default FORM.MAIN, QMF's built-in default form.
- The form never changes your data; it only changes how the data is displayed and printed.
- One form can be applied to many queries, and one query can be run under different forms for different audiences.
- Apply a form at run time: RUN QUERY Q1 (FORM=F1 — or set it as your default in your PROFILE.
The form panels
- FORM.MAIN — the main column layout: one row per column with heading, usage, indent, width, and edit code.
- FORM.PAGE — page headings and footings printed at the top and bottom of every page.
- FORM.DETAIL — detail heading and footing around the body of the report.
- FORM.BREAK1 through FORM.BREAK6 — headings, footings, and totals for up to six control-break levels.
- FORM.FINAL — final footing and grand totals at the end of the report.
- FORM.CONDITIONS — conditional formatting rules applied to values.
- Display them with DISPLAY FORM (current form) or DISPLAY FORM F1 (a saved form).
Customizing columns on FORM.MAIN
- COLUMN HEADING — the text printed above the column; type a multi-line heading with each line separated as the panel shows.
- USAGE — what the column does: blank for a normal column, OMIT to hide it, BREAK1–BREAK6 to group on it, or SUM, AVG, COUNT, MAX, MIN, FIRST, LAST for totals.
- INDENT / WIDTH — horizontal position and display width of the column.
- EDIT — display format: L left-justify, C center, R right-justify, plus numeric edit codes for decimals, commas, and currency.
- SEQ — sort order applied by the form (independent of the query's ORDER BY).
- Example: set DEPT column USAGE to BREAK1 and SALARY column USAGE to SUM, and the report groups by department with subtotals.
Control breaks and totals
- A control break fires when the value of a BREAK column changes — QMF can print a break footing with subtotals and start a new page.
- Define what prints at each break on the matching FORM.BREAKn panel: break headings, footings, and which USAGE columns get totaled there.
- Columns with USAGE SUM/AVG/COUNT automatically accumulate at each break level and print a grand total on FORM.FINAL.
- Breaks require the data to be ordered by the break column — use ORDER BY in the query or SEQ on the form.
Saving and managing forms
SAVE FORM AS F1
SAVE FORM AS F1 (REPLACE=YES
DISPLAY FORM F1
LIST FORMS
ERASE FORM F1 (CONFIRM=NO
RESET FORM
- SAVE FORM AS name stores the form in the catalog; (REPLACE=YES overwrites an existing one.
- RESET FORM restores the default FORM.MAIN, discarding your current form edits.
- LIST FORMS and ERASE FORM work exactly like their query counterparts.
Printing a report
PRINT REPORT
PRINT REPORT (FORM=F1
PRINT REPORT (PRINTER=PRT1
PRINT REPORT (LENGTH=66 WIDTH=132
- PRINT REPORT prints the current report using the current form and your profile's default printer.
- (PRINTER=...) overrides the destination; the valid printer names are defined by your QMF administrator.
- (LENGTH=... WIDTH=...) sets page length and line width for the printed output.
- To print to a data set instead of a printer, use EXPORT REPORT — covered in Module 4.
