Report statements split the work. PRINT, in the JOB, decides which records appear. REPORT, at the end of the JOB, decides how those records look: page title, columns, breaks, and totals. This sheet lists the verbs you reach for while coding a report. Each row links to the longer tutorial when you need the rules behind the sketch.
| Statement | Where | Purpose |
|---|---|---|
| REPORT | End of JOB | Names the report and opens the layout block |
| LINESIZE | On REPORT | Characters per line |
| PAGESIZE | On REPORT | Lines per page before a break |
| SEQUENCE | In REPORT | Orders detail lines for breaks |
| TITLE | In REPORT | Page banner |
| LINE | In REPORT | Detail columns for each printed record |
| CONTROL | In REPORT | Break field; prints subtotals when it changes |
| SUM | In REPORT | Which amount fields accumulate at breaks |
| Statement | Where | Purpose |
|---|---|---|
| PRINT report-name | JOB logic, usually under IF | Sends the current record to that report |
| HEADING | On DEFINE, or as a column label | Text above one LINE column |
1234567891011JOB INPUT EMPFILE IF STATUS EQ 'A' PRINT ACTIVE-RPT END-IF REPORT ACTIVE-RPT LINESIZE 132 PAGESIZE 60 SEQUENCE DEPT CONTROL DEPT SUM SALARY TITLE 'ACTIVE EMPLOYEES' LINE EMP-NO NAME DEPT SALARY
SEQUENCE DEPT keeps one department together. CONTROL DEPT prints a subtotal when DEPT changes and a grand total at the end. SUM SALARY totals salary only, even if other numeric columns sit on LINE. The PRINT name and the REPORT name have to match.
BEFORE-LINE, AFTER-LINE, BEFORE-BREAK, and AFTER-BREAK are procedures the report writer calls. Code them immediately after the REPORT block they belong to. The JOB does not PERFORM them.
123456REPORT ACTIVE-RPT LINESIZE 132 LINE EMP-NO NAME DEPT BEFORE-LINE. PROC * runs before each detail line END-PROC
REPORT is the sheet of paper with the title and the column boxes already drawn. PRINT is choosing a person and saying their numbers go on that sheet. CONTROL is a new sticky note every time the team name changes, with a count of the salaries you asked SUM to add.
1. PRINT belongs in:
2. TITLE versus HEADING:
3. CONTROL on a report field:
4. SUM inside REPORT:
5. LINESIZE should agree with: