The DFSORT OPTION MSGPRT controls how much or what kind of messages DFSORT writes to SYSOUT (or to the DD specified by MSGDDN). By default, a sort step can print several lines of informational messages—for example startup, record counts, and completion. In large batch environments that can make job logs very long. MSGPRT lets you suppress some or all of those messages so the log stays manageable, or redirect them to a separate dataset. This page explains what MSGPRT does, typical values (such as NONE to suppress messages), how to redirect output with MSGDDN, and when to use message suppression in production.
When DFSORT runs, it normally writes various messages to SYSOUT: product identification, control statement echoes or summaries, record counts (e.g. records in, records out), and completion or error messages. These messages help with debugging and auditing but can add many lines to the job log when you run hundreds of sort steps. OPTION MSGPRT lets you control that output. Common behavior (exact keywords depend on your product version) includes: printing all messages (default or MSGPRT=ALL), printing only errors or warnings (e.g. MSGPRT=ERROR or WARN), or printing nothing or minimal (e.g. MSGPRT=NONE). So you can reduce or eliminate informational message lines while still retaining what you need for problem determination.
| Topic | Description |
|---|---|
| Purpose | Control which DFSORT messages are printed to SYSOUT |
| Typical use | Reduce log volume; suppress informational messages |
| Redirect | OPTION MSGDDN=ddname to send messages to another DD |
| Placement | OPTION statement in SYSIN |
Specify MSGPRT on the OPTION statement in SYSIN. You can combine it with other options. Example:
12OPTION MSGPRT=NONE SORT FIELDS=(1,10,CH,A)
Or with other options:
12OPTION EQUALS,STOPAFT=1000,MSGPRT=NONE SORT FIELDS=(20,4,PD,D)
The exact allowed values (e.g. NONE, ALL, WARN, ERROR) and their meanings depend on your DFSORT or ICETOOL version. Check the z/OS DFSORT Messages, Codes and Diagnosis Guide (or equivalent) for your release. Some installations also allow OPTION parameters to be specified via DFSPARM; MSGPRT can sometimes be set there for invoked SORT/MERGE (e.g. from COBOL).
In addition to controlling how much is printed, you can control where it is printed. OPTION MSGDDN=ddname tells DFSORT to write its messages to the dataset allocated to the given DD name instead of the default (usually the step SYSOUT). In your JCL you allocate a DD with that name—for example to a sequential dataset or to SYSOUT=(A,DUMMY) if you want to discard messages. Example: OPTION MSGDDN=SORTMSG and in JCL:
12//SORTMSG DD SYSOUT=* //SORTMSG DD DSN=MY.USER.SORT.MSGS,DISP=(NEW,CATLG),SPACE=(TRK,1)
Then all DFSORT messages that would have gone to the default SYSOUT go to SORTMSG instead. This is useful when you want to keep messages in a separate file for review or audit, or when the step SYSOUT is directed elsewhere. Support for MSGDDN is product-dependent; see your documentation.
In production, you usually want to balance log size with the ability to diagnose failures. Suppressing all messages (e.g. MSGPRT=NONE) may make it harder to understand why a step failed (e.g. no record counts or control-statement echo). Many sites use a value that suppresses routine informational messages but keeps errors and warnings (e.g. MSGPRT=WARN or ERROR if available). Others use MSGPRT=NONE and rely on the step condition code and any abend dump for diagnosis. Still others keep the default and accept the larger SYSOUT. Choose based on your site's standards and how you troubleshoot sort failures.
MSGPRT does not change sort or merge logic—only what is printed. So you can use it with any other OPTION (COPY, EQUALS, SKIPREC, STOPAFT, VLSHRT, etc.). It also does not affect the step return code or abend behavior: if DFSORT hits an error, the step will still fail; MSGPRT only controls whether certain diagnostic lines appear in the output. If you use MSGDDN, messages go to that DD regardless of MSGPRT (MSGPRT controls level; MSGDDN controls destination).
The exact keyword for "suppress all" or "minimal" and the list of levels (e.g. ALL, WARN, ERROR, NONE) vary by DFSORT/Beyond Sort release. IBM documents these in the z/OS DFSORT Messages, Codes and Diagnosis Guide (often available as a PDF such as icem100). If you are unsure what values your installation supports, check that guide or your site's DFSORT standards. Writing to a log file (as mentioned in the task) is one way to capture the exact option and behavior on your system for later reference.
When the sort runs, it likes to say things out loud: "I started," "I read 1000 records," "I'm done." MSGPRT is like telling it how much to say. "Say nothing" (NONE) means it stays quiet so your log isn't full of chatter. "Say only when something is wrong" (e.g. WARN or ERROR) means it only speaks up if there's a problem. So MSGPRT is the "how much talking" switch for the sort step.
1. What does OPTION MSGPRT control?
2. Why might you want to suppress DFSORT messages?
3. How can you redirect DFSORT messages to a different dataset?
4. Should you suppress all DFSORT messages in production?
5. Where do you specify MSGPRT?