dspmsg — Display selected messages from message catalogs

Format

dspmsg [–d] [–s SetNumber] CatalogName MessageNumber ['DefaultMessage'[Arguments]]

Description

dspmsg displays either the text of a particular message from a message catalog generated with the gencat command or, if the message cannot be retrieved, a default message supplied as a parameter to the command. dspmsg directs the message to standard output. This command is intended for use in shell scripts as a replacement for the echo command.

The NLSPATH environment variable and the LANG category are used to find the specified message catalog if / (slash) characters are not used in the value of the CatalogName parameter. If the catalog named by the CatalogName parameter is not found or if the message named by the MessageNumber parameter (and optional SetNumber value) is not found, then the supplied DefaultMessage value is displayed. If a DefaultMessage value is not specified, a system-generated error message is displayed.

dspmsg allows up to ten string arguments to be substituted into the message if it contains the %s or %n$s, fprintf() conversion specification. Only string variables are allowed. If arguments are specified, then a DefaultMessage must also be specified.

Missing arguments for conversion specifications result in a dspmsg error message. Normal fprintf() subroutine control character escape codes (for example, –n) are recognized.

Options

–d
If you are receiving the default message, use this option to request debugging information about why dspmsg cannot get the message from the message catalog.
–s SetNumber
Specifies an optional set number. The default value for the SetNumber variable is 1.

Examples

To display set number 1, message number 2 of the test.cat catalog, enter:
dspmsg –s 1 test.cat 2 'message %s not found' 2

If the message is not found, message 2 not found is displayed.