The Display Message Text (DSPMSGTXT) command is used to display the text of a message when all you know is the message identifier. This command is useful because OS/400 includes many message files in several different libraries. Unless you are familiar with the system-supplied messages, it may be difficult to discover or remember which message file contains the message.
The command is easy to use, since it has only three parameters. The first parameter is MSGID where you specify the seven-character message identifier. This value must be a valid message ID; if you specify an invalid ID, an escape message is sent to your program.
You use the second parameter, ENVIRON, to specify the search order for the messages. Because the AS/400 supports a native OS/400 environment, in addition to S/36 and S/38 environments, a message may be located in multiple message files. The ENVIRON parameter is used to indicate the search order that you want the Command Processing Program (CPP) to follow to find the message. The command can search up to seven message files to find the message ID.
The third parameter, OUTPUT, is used to indicate whether you want the message to be displayed or printed. The CPP, CL program TAAMSGC, uses the system- supplied Display Message Description (DSPMSGD) command to display the message. If the DSPMSGTXT command is executed in batch, the output is always printed.
As supplied, you can only use the DSPMSGTXT command to find and display system- supplied messages. The command works by examining the first two or three characters of the message ID that you specify in the MSGID parameter. If these characters are processed in the CPP, an escape message is sent to your program.
You can modify the CPP to include a search of the message files you create. For this technique to work, you must verify that your message IDs do not start with characters used by the system-supplied messages.
MSGID Specify the message ID to be displayed. This value must be entered as a *CHAR field with a length 7.
ENVIRON Specify the environment to display first. Because some message IDs are in multiple message files, you are given the option to specify the environment to search.
400: The message files are searched in this order: OS/400, S/36 Environment, S/38 Environment.
36: The message files are searched in this order: S/36 Environment, OS/400, S/38 Environment.
38: The message files are searched in this order: S/38 Environment, OS/400, S/36 Environment.
Specify whether the output of the DSP-MSGTXT command should be displayed or directed to a spooled output file.
*: The output is directed to the display if the command is executed interactively. If the command is executed in a batch job, the output is directed to a spooled output file.
*PRINT: The output is directed to a spooled output file, regardless of how the DSPMSGTXT command is executed.
This command displays message CPF1131. The message is found in message file QSYS/QCPFMSG. The display shown is the same display used in the DSPMSGD command.
INFO: DSPMSGTXT (QATTINFO) CDO: TAAMSGG (QATTCMD) CPP: TAAMSGGC (QATTCL)
These tools are documented in Midrange Computing's QUSRTOOL Command Reference. The manual contains explanations and syntax diagrams for more than 300 useful tools.