You can override message files used in a procedure or program. The creation (Override Message File command), deletion (Delete Override command), and display (Display Override command) of message file overrides is similar to other types of overrides. Here, however, only the name of the message file, not the attributes, is overridden, and the rules for applying the overrides are slightly different.
To override a message file, use the Override Message File (OVRMSGF) command. The file overridden is specified in the MSGF parameter; the file overriding it is specified in the TOMSGF parameter.
For example, to override QCPFMSG with a user message file named USRMSGF, the following command would be used:
OVRMSGF MSGF(QCPFMSG) TOMSGF(USRMSGF)
When a predefined message is retrieved or displayed, the overriding file is searched for a message description. If the message description is not found in that file, the overridden file is searched.
There are several basic reasons to override message files:
Another way you can select the message file from which messages are to be retrieved is by changing the order of the files in the library list for the job. However, if you use this approach, the search for the message stops on the first message file found that has the specified name. If the message is not in that file, the search stops.
For example, assume that a message file named USRMSG is in library USRLIB1,
and another message file named USRMSG is in library USRLIB2. To use the
message file in USRLIB1, USRLIB1 should precede USRLIB2 in the library
list:
The system searches the first message file found with the correct name. If that file does not contain the message, the search stops. However, if you use the OVRMSGF command, the system searches the overriding file, and if the message is not there, it searches the overridden file.
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 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 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 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:
You can prevent message files from being overridden. To do so, you must specify the SECURE parameter on the OVRMSGF command.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.