MainframeMaster

MSGPRT

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.

OPTION Statement
Progress0 of 0 lessons

What MSGPRT Does

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.

MSGPRT at a glance
TopicDescription
PurposeControl which DFSORT messages are printed to SYSOUT
Typical useReduce log volume; suppress informational messages
RedirectOPTION MSGDDN=ddname to send messages to another DD
PlacementOPTION statement in SYSIN

Syntax and Placement

Specify MSGPRT on the OPTION statement in SYSIN. You can combine it with other options. Example:

text
1
2
OPTION MSGPRT=NONE SORT FIELDS=(1,10,CH,A)

Or with other options:

text
1
2
OPTION 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).

Why Suppress Messages?

  • Log volume. In batch jobs that run many sort steps (e.g. dozens or hundreds per job), each step may print several lines. Suppressing informational messages (e.g. record counts, "ICE001I" style lines) can keep SYSOUT from growing too large and make it easier to scan for real errors.
  • Cleaner review. When you only care about failures, reducing routine messages lets you focus on condition codes and error text. MSGPRT=NONE (or similar) can leave only severe messages or none, depending on the product.
  • Audit or compliance. Some sites want to direct all DFSORT messages to a dedicated dataset (e.g. for audit) while keeping the main step SYSOUT minimal. MSGDDN (see below) supports that.

Redirecting Messages: MSGDDN

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:

text
1
2
//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.

Production Considerations

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.

Interaction with Other Options

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).

Documentation and Exact Values

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.

Explain It Like I'm Five

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.

Exercises

  1. Your job has 50 sort steps and each prints 5–10 message lines. What OPTION could reduce SYSOUT size, and what should you keep in mind for debugging?
  2. You want to keep all DFSORT messages for audit but not mix them with the step SYSOUT. What option and JCL would you use?
  3. Does MSGPRT=NONE (or equivalent) change whether the step abends on a sort error? Why or why not?
  4. Where would you look to find the exact MSGPRT values supported at your site?

Quiz

Test Your Knowledge

1. What does OPTION MSGPRT control?

  • The number of records printed
  • How much or what kind of messages DFSORT writes to SYSOUT
  • The SORT key position
  • OUTFIL report format

2. Why might you want to suppress DFSORT messages?

  • To make the sort faster
  • To reduce SYSOUT volume—large batch jobs can produce many lines of messages; suppressing some keeps the log manageable
  • To avoid abends
  • MSGPRT is required for SUM

3. How can you redirect DFSORT messages to a different dataset?

  • Only by changing JCL SYSOUT
  • Using OPTION MSGDDN=ddname—allocate a DD with that name and messages go there instead of the default
  • MSGPRT does not support redirect
  • Only in ICETOOL

4. Should you suppress all DFSORT messages in production?

  • Yes; always use MSGPRT=NONE
  • It depends—suppressing informational messages can reduce log size, but you may want to keep error and warning messages for diagnosis
  • No; messages are never needed
  • Only for COPY steps

5. Where do you specify MSGPRT?

  • Only in JCL
  • On the OPTION statement in SYSIN (e.g. OPTION MSGPRT=NONE)
  • Only in DFSPARM
  • In OUTREC