FIRST-DETAIL is a report-timing conditional, not a figurative constant like SPACE or HIGH-VALUES and not a field stored on your input file. It answers a layout question: is this the first detail line after a control break, or the first detail line that will appear on a new page because the current line would overflow the page? When FIRST-DETAIL is true inside a report exit procedure, you can stamp a run date, repeat a column heading reminder, or print a short annotation that should appear only at those transition points—not on every detail line. IBM Easytrieve documentation places FIRST-DETAIL in the BEFORE-DETAIL report procedure. Broadcom Easytrieve Report Generator 11.6 emphasizes BEFORE-LINE, BEFORE-BREAK, and related report exits in its report-processing chapter. Shops migrating between products should verify which procedure name their compiler accepts. This tutorial explains FIRST-DETAIL semantics, compares POST-BREAK and DTLCTL FIRST, shows CONTROL and BREAK tests, and walks through practical report layouts for beginners.
Control reports group detail lines under CONTROL fields such as REGION, BRANCH, and DEPARTMENT. When REGION changes from EAST to WEST, a control break occurs. Totals print, headings may repeat, and the next employee detail line is the first detail line of the new group. FIRST-DETAIL is true at that moment. Page overflow creates a similar moment: when the next detail line would not fit on the current page, the report writer starts a new page and the upcoming detail is the first detail line on that page. FIRST-DETAIL is also true there. On ordinary detail lines in the middle of a group and page, FIRST-DETAIL is false.
| Report situation | FIRST-DETAIL | Why |
|---|---|---|
| Second detail line in same department on same page | False | Not first after break or new page |
| First employee line after department break | True | First detail after control break |
| First detail line at top of new page | True | Page overflow started new page |
| Total line before break | False | Totals are not detail lines |
| FINAL total at end of report | False | FINAL break is not a detail line |
Report procedures run at fixed points in the report writer lifecycle. REPORT-INPUT screens data selected by PRINT. BEFORE-LINE runs immediately before a detail line prints. AFTER-LINE follows printing. BEFORE-BREAK and AFTER-BREAK surround total lines. IBM documentation names the detail-building exit BEFORE-DETAIL and makes FIRST-DETAIL available there. Broadcom 11.6 Getting Started and Programming guides document BEFORE-LINE for detail-line events. If your site compiles with Broadcom 11.6, try BEFORE-LINE first when porting legacy BEFORE-DETAIL examples, and confirm with your release manual whether FIRST-DETAIL remains supported as a conditional keyword.
12345678910111213REPORT PAY-RPT LINESIZE 80 DTLCTL FIRST SEQUENCE DEPT EMPLOYEE-ID CONTROL DEPT TITLE 1 'PAYROLL DETAIL' LINE 01 EMPLOYEE-ID GROSS NET-PAY BEFORE-LINE. PROC WS-RUN-DATE = SPACES IF FIRST-DETAIL WS-RUN-DATE = SYSDATE DISPLAY 'AS OF' WS-RUN-DATE END-IF END-PROC
The DISPLAY adds a date annotation only when FIRST-DETAIL is true—after a break or at page top—not on every employee line. SYSDATE is a system date field documented in Broadcom reserved words.
IBM also documents POST-BREAK for BEFORE-DETAIL procedures. POST-BREAK is true only for the first detail line after a control break. It does not fire merely because a new page started without a break. Use POST-BREAK when you want break-specific messaging such as entering a new department. Use FIRST-DETAIL when page-top repetition matters too, such as repeating a short column legend after every page advance.
| Conditional | True when | Example use |
|---|---|---|
| FIRST-DETAIL | First detail after break or page overflow | Run date at page top and after breaks |
| POST-BREAK | First detail after control break only | Department banner after DEPT changes |
| IF FIELD BREAK | Field is active CONTROL on report | Logic tied to specific break level |
| IF FIELD HIGHEST-BREAK | Field caused the current break | Annotation on the breaking field only |
Beginners often confuse FIRST-DETAIL with DTLCTL FIRST. They solve related but different problems. DTLCTL is a format-determination parameter on REPORT with subparameters EVERY, FIRST, and NONE. DTLCTL FIRST tells the report writer to print CONTROL field values on the first detail line of each page and on the first detail line after each control break. On other detail lines within the group, CONTROL values are suppressed automatically. You do not need a procedure to blank them manually. The install options table also defines a compile-time DTLCTL default that REPORT can override.
12345678910REPORT SALES-RPT LINESIZE 65 DTLCTL FIRST SEQUENCE REGION BRANCH CONTROL REGION BRANCH LINE 01 SALES-REP AMOUNT * With DTLCTL FIRST: * - REGION and BRANCH print on first detail after break * - Subsequent detail lines in same group omit control values * - Use DTLCTL EVERY to repeat controls on every line * - Use DTLCTL NONE to suppress controls on detail lines
XML report output changes DTLCTL defaults per Broadcom REPORT documentation—verify XML behavior separately if you generate XML extracts.
Broadcom 11.6 documents field-class conditions BREAK and HIGHEST-BREAK for CONTROL fields. IF REGION BREAK tests whether REGION is currently processed as a CONTROL field on the report. IF REGION HIGHEST-BREAK tests whether REGION caused the break that is active. These are alternatives to comparing LEVEL or BREAK-LEVEL to specific numeric values. FIELD must appear on a CONTROL statement or be the reserved word FINAL.
12345BEFORE-BREAK. PROC IF DEPT HIGHEST-BREAK DISPLAY '--- DEPARTMENT TOTAL ---' END-IF END-PROC
Combine BREAK tests with FIRST-DETAIL carefully. A field can be an active control without the current line being FIRST-DETAIL, and FIRST-DETAIL can be true without every control field being the highest break.
LEVEL is a system-defined binary field indicating report processing level. Broadcom documents LEVEL 0 during detail line processing, LEVEL n during control totals, and LEVEL n+1 during FINAL totals. BREAK-LEVEL holds the break level of the highest field that broke. FIRST-DETAIL is a higher-level boolean for layout; LEVEL is numeric state for procedural branching. Use LEVEL when you need different math on minor versus major totals. Use FIRST-DETAIL when you need first-line decoration.
1234567891011121314DEFINE WS-TAG W 20 A BEFORE-LINE. PROC WS-TAG = SPACES IF POST-BREAK WS-TAG = '* NEW GROUP *' END-IF IF FIRST-DETAIL AND WS-TAG SPACES WS-TAG = '* PAGE START *' END-IF IF WS-TAG NOT SPACES DISPLAY WS-TAG END-IF END-PROC
Broadcom restricts DISPLAY inside report procedures: no file-name parameter, no HEX option, output goes to the associated report only. DISPLAY lines count toward page length and can affect end-of-page determination, but ENDPAGE is not invoked by those DISPLAY lines according to the Programming guide. When FIRST-DETAIL triggers DISPLAY annotations, test page breaks with realistic data volumes so annotations do not push detail unexpectedly.
IBM MU/Easytrieve reserved-keyword documentation explicitly defines FIRST-DETAIL and POST-BREAK for BEFORE-DETAIL. Broadcom 11.6 Symbols and Reserved Words lists FIRST as a reserved word but not FIRST-DETAIL in the alphabetical reserved-word table reviewed for this page. Report procedure names BEFORE-LINE and BEFORE-BREAK are documented in Broadcom 11.6. When maintaining legacy macros, search for BEFORE-DETAIL and FIRST-DETAIL and validate against your compiler. Document the mapping in shop standards so new developers do not mix incompatible procedure names.
A report is a long list of names grouped by classroom. FIRST-DETAIL is true when you are about to write the first name in a new classroom or the first name at the top of a fresh page. It is not true for every name in the middle of the list. DTLCTL FIRST is a printer rule that says write the classroom name only on those first-name lines, not on every line. POST-BREAK is like FIRST-DETAIL but only when the classroom changed, not when you simply ran out of room on the page.
1. FIRST-DETAIL is true when:
2. Where is FIRST-DETAIL normally tested?
3. REPORT DTLCTL FIRST controls:
4. POST-BREAK differs from FIRST-DETAIL because POST-BREAK:
5. IF REGION BREAK tests: