Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
The Add Message Description (ADDMSGD) command describes a message and stores it in a message file for later use. The message description remains in the message file until the file is deleted or until the Remove Message Description (RMVMSGD) command is used to remove it from the file. To change any of the attributes of the message description, such as its message text or severity code, use the Change Message Description (CHGMSGD) command.
Note: A description of how to print a single message or a group of messages is in the section entitled Handling Messages in the Basic System Operation information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Substitution variables can be embedded both in the first-level and second-level message text. They can be replaced later by message data fields specified in the Retrieve Message (RTVMSG), Send User Message (SNDUSRMSG), and Send Program Message (SNDPGMMSG) commands.
Note: The type of message being defined is not specified in the ADDMSGD command. The type is specified in the command that actually sends the message.
If the message second-level text exceeds 512 characters, it will not fit because of the OS/400 Prompter limit. In this case, enter the command on the Command Entry panel or in a CL program.
Restrictions:
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
MSGID | Message identifier | Name | Required, Positional 1 |
MSGF | Message file | Qualified object name | Required, Positional 2 |
Qualifier 1: Message file | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
MSG | First-level message text | Character value | Required, Positional 3 |
SECLVL | Second-level message text | Character value, *NONE | Optional, Positional 4 |
SEV | Severity code | 0-99, 00 | Optional, Positional 5 |
FMT | Message data fields formats | Single values: *NONE Other values (up to 99 repetitions): Element list |
Optional |
Element 1: Data type | *QTDCHAR, *CHAR, *HEX, *SPP, *DEC, *BIN, *UBIN, *CCHAR, *DTS, *SYP, *ITV | ||
Element 2: Length | Integer, *VARY | ||
Element 3: *VARY bytes or dec pos | Integer, 0 | ||
TYPE | Reply type | *CHAR, *DEC, *ALPHA, *NAME, *NONE | Optional |
LEN | Maximum reply length | Single values: *TYPE, *NONE Other values: Element list |
Optional |
Element 1: Length | Integer | ||
Element 2: Decimal positions | Integer | ||
VALUES | Valid reply values | Single values: *NONE Other values (up to 20 repetitions): Character value |
Optional |
SPCVAL | Special reply values | Single values: *NONE Other values (up to 20 repetitions): Element list |
Optional |
Element 1: Original from-value | Character value | ||
Element 2: Replacement to-value | Character value | ||
RANGE | Range of reply values | Single values: *NONE Other values: Element list |
Optional |
Element 1: Lower value | Character value | ||
Element 2: Upper value | Character value | ||
REL | Relationship for valid replies | Single values: *NONE Other values: Element list |
Optional |
Element 1: Relational operator | *EQ, *LE, *GE, *GT, *LT, *NE, *NL, *NG | ||
Element 2: Value | Character value | ||
DFT | Default reply value | Character value, *NONE | Optional |
DFTPGM | Default program to call | Single values: *NONE Other values: Qualified object name |
Optional |
Qualifier 1: Default program to call | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
DMPLST | Data to be dumped | Single values: *NONE Other values (up to 102 repetitions): 1-99, *JOB, *JOBINT, *JOBDMP |
Optional |
LVL | Level of message | Element list | Optional |
Element 1: Creation date | Date, *CURRENT | ||
Element 2: Level number | 1-99, 1 | ||
ALROPT | Alert options | Element list | Optional |
Element 1: Alert type | *IMMED, *DEFER, *UNATTEND, *NO | ||
Element 2: Resource name variable | 1-99, *NONE | ||
LOGPRB | Log problem | *NO, *YES | Optional |
CCSID | Coded character set ID | 1-65535, *JOB, *HEX | Optional |
Top |
Specifies the message identifier under which the message is stored in the message file. Every message must have an identifier, and every identifier in the message file must be unique.
This is a required parameter.
The message identifier must be 7 characters in length and in the following format: pppnnnn
The first 3 characters must be a code consisting of an alphabetic character followed by two alphanumeric (alphabetic or decimal) characters; the last 4 characters must consist of numbers ranging from 0 through 9 and characters ranging from A through F.
Top |
Specifies the message file where the message is to be stored.
This is a required parameter.
Qualifier 1: Message file
Qualifier 2: Library
Top |
Specifies the text of the message being defined. This text is the message that is initially shown or printed, or sent to a program or log. A maximum of 132 characters enclosed in apostrophes can be specified, but the limitations of the display stations (their screen size) should be considered. The entire message must be enclosed in apostrophes if blanks are included in the message. To code an apostrophe for use in the message, enter a double apostrophe.
This is a required parameter.
Double-Byte Character Set Considerations
When entering double-byte characters on this parameter, several combinations of characters may cause errors to occur on this command. If double-byte characters contain the string, X'50Fn' (where n is a 1-digit number ranging from 0 through 9), error messages CPF2424 or CPF2431 may result.
Coded Character Set Identifier (CCSID) Considerations
The text supplied for the MSG parameter is assumed to be in the CCSID of the job running this command unless the CCSID parameter is coded. If the CCSID parameter is coded, the text is assumed to be in the CCSID specified. For more information about the message handler and its use of CCSIDs, see the Globalization topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Top |
Specifies the message help that is shown to a display station user to further explain the message specified for the First-level message text (MSG) parameter. The user presses the Help key to request the message help. Message help can also be written to the job log if *SECLVL is specified for the Log in service log (LOG) parameter of the job commands.
Message help can be formatted for the work station using three format control characters. Each must be followed by a blank.
Double-Byte Character Set Considerations
When entering double-byte characters on this parameter, several combinations of characters may cause errors to occur on this command. The double-byte characters should not contain the string, X'50Fn' (where n is a 1-digit number, 0-9) or error messages CPF2424 or CPF2431 may result. Examples are: X'50F0', X'50F4', X'50F9'.
Coded Character Set Identifier (CCSID) Considerations
The text supplied for the SECLVL parameter will be assumed to be in the CCSID of the job running this command unless the CCSID parameter is coded. If the CCSID parameter is coded, the text will be assumed in the CCSID specified. For more information about message handler and its use of CCSIDs, see the Globalization topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Top |
Specifies the severity code of the message being defined. The severity code indicates the severity level of the condition that causes the message to be sent. (99 is the most important severity.)
Top |
Specifies the formats of up to 99 message data fields. Each field is described in this parameter by a list of attributes. These attributes specify the type of data in the field, the total length of the field, and, optionally, the number of decimal digits to the right of the decimal point. Certain data types do not require a length field. Boundary alignment requirements must be considered (for example, pointers are always aligned on 16-byte boundaries).
All 99 of the message data fields can be used as substitution values in the message and message help defined in this message description. They can also be specified for the Data to be dumped (DMPLST) parameter and the Alert options (ALROPT) parameter of this command.
Single values
type [length [decimal-positions]]
Element 1: Data type
The first element specifies the type of data the substitution field contains and how the data is formatted when substituted in the message text. The contents of the second and third elements vary depending on the type specified. One of the following types can be specified for each field described on this parameter:
The following formats are valid only in IBM-provided message descriptions and should not be used for other messages.
Element 2: Length
Following the type specification, a second element can be specified to indicate the number of characters or digits that are passed in the message data. How the second element is used depends on the type specified in the first element.
Element 3: *VARY bytes or dec pos
The third element is used in one of two ways, depending on the type specified in the first element: (1) If *QTDCHAR, *CHAR, *CCHAR, *HEX, or *SPP is specified, and if *VARY is specified or assumed for the second element, the third element is used with *VARY to indicate the size of the length field actually passed. The third element can be either a 2 or a 4, which is the number of bytes used to specify the length (in binary) of the passed value. (2) If *DEC is specified, the third element indicates the number of decimal positions in the decimal value. If not specified, the default is 0 decimal positions.
Note: If an object has been damaged or deleted, the substitution variable is not replaced by the object name when it is displayed; instead, the variable appears as &n, where n = number. Also, if the length of the message data that is passed to the substitution variable is shorter than the length specified, the substitution value becomes a null field.
Top |
Specifies the type of reply that can be made to an inquiry or notify message.
Top |
Specifies the maximum length of a reply to an inquiry or notify message. The values specified apply only if one or more of the other validity checking parameters are specified. If none of the validity checking parameters are specified, the reply can contain up to 132 characters.
Single values
Element 1: Length
Element 2: Decimal positions
Top |
Specifies a list of values of which one can be received as a valid reply to an inquiry or notify message. No more than 20 values can be specified in the list. Each value in the list must meet the requirements specified for message replies for the Reply type (TYPE) parameter and the Maximum reply length (LEN) parameter. If this parameter is specified, the Range of reply values (RANGE) parameter and the Relationship for valid replies (REL) parameter cannot be specified.
Single values
Other values
Top |
Specifies a list of up to 20 sets of special values of which one set is used as the reply to an inquiry or notify message. The reply sent is compared to the from-value in each set; if a match is found, and a to-value was specified in that set, the to-value is sent as the reply. If no to-value was specified, the from-value is sent as the reply.
The to-value must meet the requirements specified on the Reply type (TYPE) parameter and the Maximum reply length (LEN) parameter.
Single values
Element 1: Original from-value
Element 2: Replacement to-value
Top |
Specifies the upper and lower value limits for valid replies sent to an inquiry or notify message. These values must meet the requirements specified on the Reply type (TYPE) parameter and the Maximum reply length (LEN) parameter, and both values must be of the same type.
If this parameter is specified, the Valid reply values (VALUES) parameter and the Relationship for valid replies (REL) parameter cannot be specified.
Single values
Element 1: Lower value
Element 2: Upper value
Top |
Specifies the relationship that must be met for a valid reply to an inquiry or notify message. The value specified must meet the requirements specified for replies on the Reply type (TYPE) parameter and the Maximum reply length (LEN) parameter.
If this parameter is specified, Valid reply values (VALUES) parameter and the Range of reply values (RANGE) parameter cannot be specified.
Single values
Element 1: Relational operator
Element 2: Value
Top |
Specifies, if the message is sent as an inquiry or notify message, the default reply that is used when the receiver of the message has indicated that all incoming messages are to receive default replies, or when a message is deleted from a message queue and no reply is specified. The default reply must meet the requirements specified for replies on the Reply type (TYPE) parameter and the Maximum reply length (LEN) parameter.
Top |
Specifies the qualified name of any default program called to take default action if this message is sent as an escape message to a program or procedure that is not monitoring for it. This parameter is ignored if the message is not sent as an escape message. If the message is sent as an escape message, the following parameters are passed to the specified default program:
Characters 1 through 10 are the name of the program to which the message is sent.
Characters 11 through 20 are the name of the module to which the message is sent. If the message is not sent to an ILE procedure, the value *N is returned in this field padded on the right with blanks.
Characters 21 through 276 are the name of the procedure to which the message is sent. If the message is not sent to an ILE procedure, the value *N is returned in this field padded on the right with blanks.
Character 277 is set to the value 1 if the message is sent to an ILE procedure, or to the value 0 if the message is not sent to an ILE procedure.
Single values
Qualifier 1: Default program to call
Qualifier 2: Library
Top |
Specifies the data that is dumped when this message is sent as an escape message to a program that is not monitoring for it. This parameter can specify that data related to the job be dumped, that data from message data fields be dumped, or that a combination of these be dumped.
Single values
Other values
Top |
Specifies the level identifier of the message description being defined. The level identifier is made up of the date on which the message is defined and a 2-digit number that makes the identifier unique.
Element 1: Creation date
Element 2: Level number
Top |
Specifies the alert option associated with messages sent to the system operator message queue (QSYSOPR). Alerts can be used to send a message to the host system indicating that an error has occurred on this system.
Element 1: Alert type
Element 2: Resource name variable
Top |
Specifies, for IBM-supplied messages, whether an entry is put into the problem log. If there is an error log ID for the message and *YES is specified for this parameter, the user can request problem analysis by pressing F14 from the system operator message queue display (by running the DSPMSG *SYSOPR command).
Top |
Specifies the coded character set identification (CCSID) that the text supplied for the MSG and SECLVL parameters is in. If the message file that this message description is being added to is not 65534 or 65535, the text supplied is converted from the CCSID specified to the CCSID of the message file. Otherwise, the text is not converted but the CCSID is saved in case a conversion is needed during a retrieve or display function. For more information about the message handler and its use of CCSIDs, see the Globalization topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Top |
Example 1: Defining a Message
ADDMSGD MSGID(UIN0115) MSGF(INV) MSG('Enter the name of user''s department') SECLVL('Valid departments: &B X12 &B X13 &B X14') TYPE(*CHAR) LEN(3) DFT('ZZZ')
This command defines a message and stores it in a file named INV under the identifier UIN0115. The message supplies second-level message text by using the &B formatting character to show the three valid department names (X12, X13, and X14) each on a separate line. The reply requires validity checking so that a valid reply can only be a 3-character identifier. A default reply of ZZZ is also provided.
Example 2: Defining a Message Description
ADDMSGD MSGID(UPY0047) MSGF(PAYLIB/TIMECARD) MSG('For week of &1, &2 time cards. Are there more?') FMT((*CHAR 8) (*CHAR 3)) TYPE(*ALPHA) LEN(1) VALUES(N Y) SPCVAL((YES Y)(NO N)) DFT(N)
This command defines a message description that is stored in the TIMECARD message file in the PAYLIB library. The program that processes the time cards can send a message (as an inquiry type message) telling how many time cards (in &2) have been processed for the week (specified in &1). To send this message to a user via a message queue, the program must use the SNDPGMMSG or SNDUSRMSG commands. In this example, the command specifies:
If a reply of YES is sent, it is accepted as a Y (SPCVAL parameter). If NO is sent, it is accepted as an N. If neither YES nor NO is sent, the reply is checked for validity by the TYPE, LEN, and VALUES parameters. If the user chooses, no reply is sent and the default reply (N) is assumed.
Example 3: Defining an Escape Message
ADDMSGD MSGID(UPY1234) MSGF(PAYLIB/TIMECARD) MSG('Tax for employee &1 exceeds gross salary.') SEV(75) FMT((*CHAR 6) (*DEC 9 2) (*CHAR 8)) DFTPGM(PAYLIB/BADTAX) DMPLST(1 2 3 *JOB)
This command defines an escape message. The sender of the message passes three data values, the first of which (employee serial number) is used as replacement text in the message. If this message is sent as an escape message and the program to which the message is sent does not monitor for message UPY1234, default system action is taken. This includes dumping the three data values that were passed and the job structure. After the dump is taken, program BADTAX is called.
See the Monitor Message (MONMSG) command for more about monitoring for messages.
Top |
*ESCAPE Messages
Top |