How to search message files

While working with message file descriptions you have probably noticed the lack of a built-in search facility. With wrkmsgf you can 'position to' a message id but many times the need is finding the message id based on some or all of a message description. This limitation can be easily overcome with the two step process of printing the message file and using the spool file search bar.

The real trick is remembering to use the display command instead of the 'work with' and knowing how to print the message file in a format that you can search.

To spool the entire message file to an output queue;

dspmsgd range(*all) msgf(mylib/mymsgf) detail(*basic) output(*print)

Then just use wrksplf and enter your search phrase in the (case-sensitive) Find field.

If you do not find a match consider one reason might be that occasionally a message will have data substituted into the text at run-time. Try your search with what you think will be non-variable text. To find substitution parameters search for "&1", "&2", etc.

To pass an entire phrase to your message handler you can create a message with a single substitution parameter (as "&1") of type *CHAR.

Other common message file commands you should know;

mrgmsgf (merge messages from one message file to another)
ovrmsgf (override a message file - if a message is not found in the overriding file then the overridden file is searched)