The DISPLAY statement is the workbench screwdriver of Easytrieve debugging. You do not redesign the whole report to see one counter, one branch decision, or one suspicious packed field. You add a DISPLAY line, rerun the test job, and read SYSPRINT. This tutorial focuses on diagnostic patterns—not the full DISPLAY grammar covered on the statement reference page—so you learn how to trace logic, label branches, dump hexadecimal bytes, route output conservatively, and clean up before production. Output destinations depend on JCL, batch versus online context, and site standards; this page states what Broadcom documents as defaults and warns where local configuration may differ.
Debugging is the art of comparing what you expected with what happened. Easytrieve hides much iteration inside JOB INPUT loops and report procedures, so the executing program can feel like a black box. DISPLAY opens the box one line at a time. Because DISPLAY does not require a REPORT definition, you can insert a trace in minutes, recompile, and see output on the next test run. When the defect is fixed, you remove or comment out the trace. That short feedback loop is why experienced mainframe developers still reach for DISPLAY even when interactive debuggers exist elsewhere in the data center.
DISPLAY is not a replacement for structured logging products or for ABEXIT Error Analysis after an abend. It is a low-ceremony trace mechanism you control in source. Pair DISPLAY with compile listings so you know which statement numbers correspond to your traces if FLOW or STATE options are also enabled.
When you code DISPLAY without naming a file, Broadcom sends the line to SYSPRINT, the default system print file. In batch, SYSPRINT is almost always allocated in JCL with a spool class or a temporary data set. That is why beginners can add DISPLAY 'HELLO' and see output without defining a new FILE. The visible location—SDSF, a held queue, a development class, or a permanent data set—is determined by your JCL and site rules, not by the DISPLAY statement alone.
123456//DBGTEST EXEC PGM=INVRPT //STEPLIB DD DSN=DEV.APP.LOADLIB,DISP=SHR // DD DSN=DEV.EZT.CBAALOAD,DISP=SHR //INVFILE DD DSN=DEV.INVENTORY.SAMPLE,DISP=SHR //SYSPRINT DD SYSOUT=* //INVREP DD SYSOUT=A
Diagnostic DISPLAY lines typically appear in the SYSPRINT stream, while the business report routes to INVREP. If you search the wrong DD in SDSF, you will conclude DISPLAY is broken when it simply wrote to a different output stream. Always confirm which DD names your program uses before debugging output routing.
In JOB activities you may optionally code a display-file-name on DISPLAY to write to a named sequential output file defined in your program and allocated in JCL. That pattern separates bulky debug traces from SYSPRINT so operators can discard a DEBUG DD without losing critical abend messages. Whether a given file name is valid depends on your FILE definitions and JCL. If you use a named debug file, document its DD in test JCL only and remove it from production unless operations approves permanent diagnostic data sets.
1234FILE DEBUGTRK FB(80 800) JOB INPUT INVFILE DISPLAY DEBUGTRK 'REC' REC-COUNT EMPNO QTY REC-COUNT = REC-COUNT + 1
Here DISPLAY writes trace lines to DEBUGTRK instead of SYSPRINT. JCL must allocate DEBUGTRK with appropriate space and disposition for test. This pattern keeps SYSPRINT readable when traces fire on every input record.
The most common DISPLAY debugging pattern labels a branch. When an IF condition selects records, display a short literal, the key fields, and a counter so you can verify the branch executed the expected number of times. Counters should be ordinary numeric fields initialized in working storage or reset at job start. Seeing SELECT-COUNT = 0 when you expected thousands immediately tells you the condition is wrong or the input order differs from your assumption.
123456789JOB INPUT PERSNL READ-COUNT = READ-COUNT + 1 IF DEPT = 100 SEL-COUNT = SEL-COUNT + 1 DISPLAY 'DEPT100' EMPNO DEPT SEL-COUNT END-IF IF READ-COUNT = 1 DISPLAY 'FIRST REC' EMPNO DEPT END-IF
FIRST REC confirms layout and file open success on the initial record. DEPT100 lines prove the branch fires and show how many selects occurred. Keep literals short and distinctive so you can search SYSPRINT quickly.
For procedures, paragraphs, or complex paragraph groups, bookend markers reduce confusion about whether execution reached a section. Display a literal on entry, another before RETURN, and a third after unexpected paths. This pattern is especially helpful when multiple PERFORM or CALL paths exist and FLOW tracing is disabled to save overhead.
12345678CALC-TAX. PROC DISPLAY '>> CALC-TAX ENTER' EMPNO TAX = GROSS * RATE IF TAX < 0 DISPLAY '!! NEG TAX' EMPNO GROSS RATE TAX END-IF DISPLAY '<< CALC-TAX EXIT' TAX END-PROC
Angle brackets in literals are a visual convention only; Easytrieve prints them as text. If you see ENTER without EXIT for the same employee key, you know control left the procedure abnormally or branched elsewhere before END-PROC.
Normal DISPLAY formats fields according to their definitions and masks. Packed decimal, binary, and bit data often print as unexpected characters or apparent blanks. DISPLAY HEX prints the underlying bytes in hexadecimal, which is the standard mainframe approach for inspecting numeric encodings without a full storage dump. Use HEX on the smallest field that is suspect first; dump entire records only when record layout itself is in question.
12345IF GROSS = 0 AND HOURS > 0 DISPLAY 'ZERO GROSS CHECK' EMPNO DISPLAY HEX GROSS DISPLAY HEX HOURS END-IF
This trace catches logical inconsistency—hours worked with zero gross pay—and shows whether GROSS is truly zero in packed form or whether a data exception is imminent because the field contains non-numeric bytes.
The statement reference documents a separate HEX format of DISPLAY rather than an option on the standard item list. Syntax details appear on the DISPLAY statement page for your release. Do not confuse DISPLAY HEX with ABEXIT SNAP dumps; HEX is a controlled field view, not a capture of the entire address space.
Unformatted DISPLAY output becomes unreadable when many lines print without structure. Use SKIP to separate sections and COL to align keys and amounts in fixed columns. SKIP 0 overprints the previous line and is rarely useful in modern debugging; prefer explicit column positioning instead. CONTROL carriage control is uncommon in contemporary batch debugging but remains documented for specialized printer environments.
| Option | Debugging use |
|---|---|
| (default SYSPRINT) | Quick traces without extra FILE or DD setup |
| Named display file | Isolate high-volume traces away from SYSPRINT |
| SKIP n | Blank lines between sections of trace output |
| COL n | Align keys and amounts for manual scanning |
| HEX field | Inspect packed, binary, or corrupt fields |
| NOTITLE | New page without report headings for summary traces |
Report procedures introduce restrictions beginners stumble on. Broadcom documents that DISPLAY inside report procedures writes only to the system output device, not to arbitrary named data files. DISPLAY lines may also interact with report sequencing—appearing before the first title or interleaved with report activity depending on context. When debugging a report procedure, start with a few DISPLAY lines at BEFORE-LINE or AFTER-LINE hooks with short literals, then expand. If output seems missing, verify you are reading SYSPRINT rather than the formatted report DD.
12345REPORT PAY-RPT BEFORE-LINE DISPLAY 'DETAIL' EMPNO DEPT AFTER-LINE LINE-CNT = LINE-CNT + 1
This shows each detail line selection on SYSPRINT while the formatted report still routes through PRINT to its report file. You can compare whether PRINT fired for records you expected.
Screen activities introduce terminal output paths that differ from batch spool. DISPLAY behavior in online Easytrieve may not land in the same SYSOUT classes you use for nightly batch. Some shops route online diagnostics to a log data set, a terminal screen in test mode, or a vendor trace facility. Because this varies by release and installation, treat online DISPLAY destinations as a site question: ask which DD or log file captures diagnostics for screen programs in your test region before assuming batch JCL patterns apply unchanged.
DISPLAY inside tight loops on million-record files can multiply job time and spool use. Guard traces with conditions so they print only when an error flag is set, on the first N records, or for a known test key. Never print national identifiers, salaries, or account numbers in production SYSPRINT unless policy allows it; use masked fields or test data subsets. Operations teams have rejected promotions because a developer left verbose DISPLAY in a payroll loop.
DISPLAY complements other techniques. Compiler listings catch syntax and many data definition errors before run time. PARM DEBUG STATE and FLOW help after abends. DISPLAY fills the gap during successful or partially successful runs when you need to see intermediate values. Neither DISPLAY nor FLOW replaces the other: DISPLAY shows data values you choose; FLOW shows statement numbers the product recorded.
Treat debug DISPLAY as temporary instrumentation. Before merge to production source libraries, search members for DISPLAY literals you added during investigation. Some teams wrap test-only traces in a flag field set from PARM or a control card; others require complete removal. Also remove test-only DEBUG DD statements from JCL procs so schedulers do not allocate unused data sets. Code review checklists should include a DISPLAY sweep for payroll, healthcare, and financial applications where spool exposure creates compliance risk.
DISPLAY is like shouting a note to yourself while you work. You say, I am on step three, the box count is twelve, and this label looks wrong. You shout to the SYSPRINT notebook, which is taped to the wall where you can read it after the job finishes. HEX is like drawing the secret dots on the label so you can see the real pattern. When the job is fixed, you stop shouting because the wall is full of notes and other people should not see private information.
Wrap the procedure with DISPLAY '>> TAX ENTER' key-field before calculations and DISPLAY '<< TAX EXIT' result-field after calculations. If ENTER appears without EXIT for the same key, execution left early through an IF branch or abnormal termination before END-PROC.
Code IF READ-COUNT <= 5 DISPLAY 'SAMPLE' READ-COUNT key-fields END-IF inside the input loop. Only the first five records print, limiting spool volume while you validate layout and basic field values.
Keep routine messages and abend-related output on SYSPRINT DD SYSOUT=*. Route per-record traces to DEBUGTRK DD with a modest space allocation and DISP suitable for test discard. High-volume traces go to DEBUGTRK; operators retain familiar SYSPRINT for failure triage.
When balance is zero but activity count is positive, DISPLAY a literal identifying the condition, print readable keys, then DISPLAY HEX on the packed balance and activity fields. Compare hex patterns to valid packed zero versus unreadable nybbles that predict S0C7.
Debug DISPLAY increases spool volume and job time, may expose sensitive fields on SYSOUT, and clutters operator review of real failures. Production jobs should emit only approved diagnostics.
PRINT drives a formatted REPORT with titles, headings, and control breaks. DISPLAY writes a simple line immediately with minimal setup. For tracing flags, counters, and branch messages during test, DISPLAY is faster and easier to add and remove.
Usually on SYSPRINT when you do not name a file, routed by JCL such as SYSPRINT DD SYSOUT=*. The exact spool class, dataset, or online destination depends on your JCL and site standards. Online screen programs may route diagnostics differently; check your environment documentation.
Technically yes, but practically no. Printing every field on large files creates huge spool volume, slows jobs, and may expose personal or financial data. Print selective traces at branch points, sample records, or when error flags are set.
DISPLAY HEX is a developer-chosen snapshot of specific fields or records in readable hexadecimal form on SYSPRINT. Dump analysis refers to Error Analysis reports and optional ABEXIT storage dumps after abnormal termination. HEX helps you inspect data during normal or test runs; dumps help after a crash.
Not necessarily. In sequenced reports, DISPLAY lines may appear before the first report title or interleaved according to activity and procedure rules. For predictable diagnostic placement, use explicit SKIP and COL, and read Broadcom documentation for report-procedure DISPLAY behavior in your release.
1. The fastest way to see a variable value during a test run is usually:
2. DISPLAY HEX is most useful when:
3. If you omit the display file name on DISPLAY, output goes to:
4. Inside a report procedure, DISPLAY output is restricted because:
5. Before promoting a program to production you should: