To change the severities of compiler messages or suppress compiler messages (including FIPS messages),
do the steps described below.
- Code and compile a COBOL program named ERRMSG.
The program needs only a PROGRAM-ID paragraph,
as described in the related task.
- Review the ERRMSG listing, which contains a complete list
of compiler messages with their message numbers, severities, and message text.
- Decide which messages you want to customize.
To understand the customizations that are possible, see the related reference about
customizable compiler-message severities.
- Code a MSGEXIT module to implement the customizations:
- Verify that the operation-code parameter indicates
message-severity customization.
- 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.
- 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
- 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
- Compile and link your MSGEXIT module.
Ensure that the module is linked
as a
shared library.
For example:
cob2 -o -qNOEXIT -q32 MYEXIT myexit.cbl -be MYEXIT -bM:SRE
- Set LIBPATH
to make the MSGEXIT module available to the compiler.
For example, if the shared
object is in /u1/cobdev/exits,
use this command:
export LIBPATH=/u1/cobdev/exits:$LIBPATH
- Recompile program ERRMSG, but use
compiler option EXIT(MSGEXIT(msgmod)),
where msgmod is the name of your MSGEXIT module.
- 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)