Customizing compiler-message severities

To change the severities of compiler messages or suppress compiler messages (including FIPS messages), do the steps described below.

  1. Code and compile a COBOL program named ERRMSG. The program needs only a PROGRAM-ID paragraph, as described in the related task.
  2. Review the ERRMSG listing, which contains a complete list of compiler messages with their message numbers, severities, and message text.
  3. Decide which messages you want to customize.

    To understand the customizations that are possible, see the related reference about customizable compiler-message severities.

  4. Code a MSGEXIT module to implement the customizations. Start of changeRefer to the sample MSGEXIT that is included with the COBOL compiler in the SIGYSAMP dataset called IGYMSGXT. For details, see Example: MSGEXIT user exit.End of change
    1. Verify that the operation-code parameter indicates message-severity customization.
    2. Check the two input values in the message-exit-data parameter: the message number; and the default severity for a diagnostic message or the FIPS category for a FIPS message.

      The FIPS category is expressed as numeric code. For details, see the related reference about customizable compiler-message severities.

    3. For a message that you want to customize, set the user-requested severity in the message-exit-data parameter to indicate either:
      • A new message severity, by coding severity 0, 4, 8, or 12
      • Message suppression, by coding severity -1
    4. Set the return code to one of the following values:
      • 0, to indicate that the message was not customized
      • 4, to indicate that the message was found and customized
      • 12, to indicate that the operation failed and that compilation should be terminated
  5. Compile and link your MSGEXIT module.
  6. Add the data set that contains your MSGEXIT module to the compiler concatenation by using a STEPLIB or JOBLIB DD statement.
  7. Recompile program ERRMSG, but use compiler option EXIT(MSGEXIT(msgmod)), where msgmod is the name of your MSGEXIT module.
  8. Review the listing and check for:
    • Updated message severities
    • Suppressed messages (indicated by XX in place of the severity)
    • Unsupported severity changes or unsupported message suppression (indicated by a severity-U diagnostic message, and compiler termination with return code 16)