Find source attributes using the Display Program command

Many times you need to find the source (file/library/member) that was used when an object was created. When you use the display object description command dspobjd to retrieve the service related attributes the resulting information for the source member and source file and library is sometimes blank. According to the dspobjd source file help, for ILE *PGM and *SRVPGM objects the source file/library/member fields are supposed to be blank as this information is stored with the *module object. This can cause confusion when no *module object exists.

A simple solution is to use the display program command dsppgm. When used properly the display program command will almost always provide the location of the original source information.

dsppgm mylib/mypgm

Typing dsppgm along with the program name and pressing Enter presents the program information screen "display 1 of 7". Pressing Enter twice takes you to the "display 3 of 7" screen which allows input of option '5=Display description'. Typing option 5 and pressing Enter presents the "module attributes" along with the name and location of the source used when creating the object.

The source information is also available for copies of the original object. That is, if a program object is duplicated (e.g. copied using crtdupobj) using dsppgm for the new copy the original source information will display.

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)