MainframeMaster

DEBUG Statement

The DEBUG control statement tells DFSORT to produce additional diagnostic or trace output. It is used when you need to see how control statements were parsed, how many records passed through each phase, or other internal information to diagnose abends or wrong results. The exact syntax and options (e.g. what is traced) depend on your DFSORT product and version; see the DFSORT Messages and Diagnosis or Application Programming guide. DEBUG output typically goes to SYSOUT (the same place as normal ICE messages). Because DEBUG can add overhead and large output, it is usually enabled only during problem determination and removed or turned off in production. This page covers the purpose of DEBUG and when to use it.

Control Statements
Progress0 of 0 lessons

What DEBUG Does

DEBUG enables extra reporting from DFSORT. The product may trace control statement interpretation, record counts at various stages, or dump sample records. This helps you verify that SYSIN was read correctly, that INCLUDE/OMIT or INREC/OUTREC are applied as you expect, and that record lengths and keys match what you assume. When a step fails with an ICE or system abend, or when the output is wrong, adding DEBUG (and re-running) often gives the clue needed to fix the control statements or data.

Using DEBUG

Code DEBUG (or the form your product supports, e.g. DEBUG=option or DEBUG option) in SYSIN with the rest of your control statements. Run the job and inspect the SYSOUT for the step. Look for messages that show parsed statements, counts, or record content. Turn DEBUG off once the problem is resolved to avoid unnecessary output and cost.

Documentation

The exact DEBUG syntax and options are product- and version-specific. Refer to your installation's DFSORT (or Syncsort) documentation—Messages, Codes and Diagnosis Guide, or Application Programming Guide—for the full list of DEBUG options and the format of the trace output.

Explain It Like I'm Five

DEBUG is like asking the sorter to "show your work"—to print out what it understood from your instructions and how many cards it handled at each step. So when something goes wrong, you can see where the mistake happened.

Exercises

  1. When would you add DEBUG to a sort step? When would you remove it?
  2. Where do you look to see DEBUG output after the job runs?

Quiz

Test Your Knowledge

1. What is the DEBUG statement used for in DFSORT?

  • To sort by key
  • To request additional diagnostic or trace output so you can see how control statements are interpreted and how data is processed
  • To merge files
  • To define INREC

2. Where does DEBUG output typically go?

  • To SORTOUT
  • To SYSOUT (or the DD used for sort messages) so you can view it in the job output
  • To SORTIN
  • To a separate dataset only

3. When would you add a DEBUG statement?

  • In every production job
  • When diagnosing why a sort step is failing or producing unexpected results
  • Only for MERGE
  • Only for JOINKEYS