Override message files

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:


In this 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.