Example: Override a message file

This example shows how to change a message used in a job.

Assume that you want to change an IBM-supplied message for use in a job. For example, suppose you want to change message CPC2191, which says:

Object XXX in YYY type *ZZZ deleted

to say:

Object XXX in YYY deleted

Specifics on how to describe the FMT parameter are provided by displaying the detailed description of CPC2191.

First, you create a message file:

CRTMSGF MSGF(USRMSG/OVRCPF)

Then you use the message CPC2191 as a basis for your message and add it to the message file:

ADDMSGD  MSGID(CPC2191) MSGF(USRMSG/OVRCPF) +
         MSG('Object &1 in &2 deleted') +
         SEV(00) FMT((*CHAR 10) (*CHAR 10))

You then use the Override Message File (OVRMSGF) command to override the message file when you run the job:

OVRMSGF MSGF(QCPFMSG) TOMSGF(USRMSG/OVRCPF)

You then use the OVRMSGF command to override the message file when you run the job: OVRMSGF MSGF(QCPFMSG) TOMSGF(USRMSG/OVRCPF).

If you want to change this message for use in all your jobs, you can use the Change Message Description (CHGMSGD) command to change the message. Then you do not have to override the system message file.

If you use the Change Message Description (CHGMSGD command to change an IBM-supplied message, the message will need to be changed again when a new release of the system is installed. To change the message again, you can place any changes in an input stream or a program that can be run at any time.

You can also override overriding files. For example, you can specify the following Override Message File (OVRMSGF) commands during a job.

OVRMSGF  MSGF(MSGFILE1)  TOMSGF(MSGFILE2)
OVRMSGF  MSGF(MSGFILE2)  TOMSGF(MSGFILE3)

First, file MSGFILE1 was overridden with MSGFILE2. Second, MSGFILE2 was overridden with MSGFILE3. When a message is sent, the files are searched in this order:

  1. MSGFILE3
  2. MSGFILE2
  3. MSGFILE1

You can prevent message files from being overridden. To do so, you must specify the SECURE parameter on the Override Message File (OVRMSGF) command.