The DISPLAY statement transfers data to a print file or sequential file as a simple, unformatted line. Where the PRINT statement drives a full REPORT complete with titles, column headings, and control breaks, DISPLAY writes exactly what you list - fields, literals, or a mix of both - with only lightweight spacing and positioning controls. Because it needs no REPORT definition, DISPLAY is the fastest way to emit a message, print a running total, or dump a field while you are debugging. When you do not name an output file, DISPLAY writes to SYSPRINT, the default system print device that almost every batch Easytrieve job already allocates. This makes it ideal for beginners: a single line such as DISPLAY 'JOB STARTED' produces visible output with no setup. This tutorial explains the full DISPLAY grammar, every option in order (TITLE, NOTITLE, SKIP, CONTROL, COL, POS, the plus and minus offsets, the font-number sub-option, and the HEX format), where the output physically appears in batch versus report procedures, and the practical patterns mainframe programmers rely on for tracing logic and printing control totals. Each option is explained in plain language with a beginner example so you can see not just the syntax but what it actually changes on the printed page.
The Broadcom Easytrieve 11.6 Language Reference documents two formats for DISPLAY. The first is the standard data format used for printing fields and literals; the second is the HEX format used for hexadecimal dumps. This is the standard format:
1234567891011[display-file-name] [{TITLE | NOTITLE}] DISPLAY [ ] [SKIP skip-integer] + [SYSPRINT ] [CONTROL 'carriage-control-character'] [ [ ] field-name ] [ [#font-number] ] [ [ ] 'literal' ] [ +offset ] ... [ -offset ] [ COL column-number ] [ POS position-number ]
Reading it left to right: you optionally name the file, optionally control the page and spacing, then list one or more items to print. Everything in square brackets is optional, and the ellipsis means you can repeat the item list as many times as fits on the line. The plus sign at the end of the first block is an Easytrieve continuation character, showing the statement continues on the next source line.
The power of DISPLAY comes from its options. Because each one changes the output in a specific way, the table below defines every option, and the paragraphs that follow show how they behave in practice. Understanding the difference between these values is the key to using DISPLAY well.
| Option | What it does |
|---|---|
| display-file-name | Names the print or sequential file to write to. Omit it and output goes to SYSPRINT. |
| TITLE | Skips to a new page before printing and produces titles/headings when in a report procedure. |
| NOTITLE | Skips to a new page before printing but suppresses titles and headings. |
| SKIP skip-integer | Skips the given number of blank lines before printing. SKIP 0 overlays the previous line (overprint). |
| CONTROL 'char' | Places a specific ANSI carriage-control character in column 1 to command the printer directly. |
| field-name | Prints the current value of a defined field, formatted per its data type and MASK. |
| 'literal' | Prints the exact text between the quotes - used for labels, messages, and separators. |
| +offset / -offset | Moves the print cursor forward (+) or backward (-) a number of columns relative to the current position. |
| COL column-number | Sets the absolute print column where the next item begins - used to line items up in fixed columns. |
| POS position-number | Sets an absolute position for the next item, an alternative to COL used with the reporting environment. |
| #font-number | Selects a font number for the next item on printers that support the extended reporting environment. |
Both TITLE and NOTITLE force a page eject - the printer advances to the top of a fresh page before your data prints. The difference is what happens to headings. TITLE reprints any titles and column headings you defined in a report procedure, so the new page looks like a proper report page. NOTITLE gives you a clean, empty page with just your DISPLAY line, which is what you want for special messages such as an end-of-run summary that should not carry report headings. If you code DISPLAY outside a report procedure, TITLE still ejects the page but there are no titles to print, so the practical effect is the same as NOTITLE.
123IF DEPT = 911 DISPLAY NEWPAGE POLICY SSN DATE-OF-BIRTH END-IF
In this example the DISPLAY starts a new page and prints three fields beginning in column 1, the default. NEWPAGE is a synonym accepted for the page-eject behaviour in many releases.
SKIP inserts blank lines before your data so output is readable rather than cramped. SKIP 3 leaves three blank lines then prints, which visually separates a total from the detail above it. A special case is SKIP 0: instead of skipping, it overlays the new line on top of the previous line at the same print position. Overprinting was historically used for underlining or bolding on impact printers and is rarely needed today, but knowing SKIP 0 does not advance the paper prevents confusing bugs.
123IF STATE = 34 DISPLAY SKIP 3 'THE STATE IS' STATE END-IF
After skipping three lines this prints the label followed by the STATE value, both starting from column 1. The value of STATE is inserted automatically wherever the field name appears in the item list.
By default each item prints immediately after the previous one with a single separating space. To line data up in neat columns, use COL to jump to an absolute print column. COL 7 tells Easytrieve the next item starts in column 7 regardless of what came before, which is exactly how you build a tidy trace with aligned labels. The +offset and -offset controls move relative to the current position - handy for nudging an item a few columns without counting from the page edge. POS is similar to COL but is tied to the extended reporting environment and interacts with font sizing, so for ordinary line output COL is the option you will reach for.
123IF DEPT = 911 DISPLAY COL 7 '*** ERROR ***' END-IF
Here the literal begins in column 7 instead of the default column 1. Aligning error flags in a consistent column makes them easy to spot when scanning a long SYSPRINT listing.
Packed decimal, binary, and other non-character fields do not print as readable text - they look like random symbols on a normal DISPLAY. The HEX format solves this by printing the hexadecimal byte values instead, so you can see exactly what is stored. This is one of the most valuable debugging tools in Easytrieve because it reveals data that would otherwise be invisible.
1234567[display-file-name] [{TITLE | NOTITLE}] [ file-name ] DISPLAY [ ] [SKIP skip-integer] HEX [ field-name ] [SYSPRINT ] * Example: dump the whole input record and one packed field DISPLAY HEX PERSNL DISPLAY 'WHO = ' WHO HEX WHO
You can dump an entire record by naming the file, or a single field by naming the field. Comparing the readable value and its HEX bytes side by side quickly explains problems such as a packed field that never got initialized or contains sign nibbles you did not expect.
The physical destination depends on where you code DISPLAY. In the logic portion of a JOB activity with output going to a report, the DISPLAY lines are interspersed through an unsequenced report, or printed at the very beginning of a sequenced report - before the first title. Inside a report procedure, DISPLAY is restricted to the system output device only; you cannot DISPLAY to a data file from a report procedure. Knowing this avoids the common surprise of DISPLAY lines appearing in an unexpected order relative to report detail lines.
| Where DISPLAY is coded | Where the line appears |
|---|---|
| JOB logic, no file named | SYSPRINT, mixed with any report output |
| JOB logic, file named | The named print or sequential file |
| Report procedure | System output device only (no data file allowed) |
| Sequenced report | DISPLAY lines print before the first report title |
Beginners often ask which output statement to use. PRINT sends a record to a named REPORT and lets the report writer handle titles, headings, column spacing, page breaks, and totals automatically. DISPLAY does none of that automation - it prints one line exactly as listed. Choose PRINT when you want a formatted, professional report. Choose DISPLAY when you want a quick message, a control total at end of job, or a debugging trace that does not belong in the formatted output. Many production jobs use both: PRINT for the report, DISPLAY for operator messages and run statistics.
DISPLAY is like writing one line on a whiteboard with a marker. You write the words and numbers you want, right there, straight away. You can leave a few empty lines first (that is SKIP), start writing further along the board (that is COL), or turn to a brand new board (that is a new page). PRINT is different - PRINT is like filling in a neat printed worksheet with headings and boxes. When you just need to jot a quick note, you use DISPLAY. And if the marker looks like scribbles because the thing you are writing is secret computer code, HEX turns it into numbers you can read.
1. What does the Easytrieve DISPLAY statement do?
2. Where does DISPLAY output go if you do not name a file?
3. What does the TITLE option on DISPLAY do?
4. How do you start a DISPLAY item at an absolute column?
5. Which DISPLAY option produces a hexadecimal dump of a field or record?