Command reference / msg

ADDMSGD

Add Message Description

Defines a message and stores it in a message file for later use. The description stays in the file until the file is deleted or RMVMSGD removes it. To change attributes such as the text or severity, use CHGMSGD. The message type is not set here; it is specified by the command that sends the message. Substitution variables (&n) can be embedded in the first- and second-level text and are replaced by data supplied through RTVMSG, SNDUSRMSG, or SNDPGMMSG. Second-level text over 512 characters does not fit the prompter limit, so enter such a command on the Command Entry display or in a CL program.

Allowed environments: *ALL. Positional parameters: 5.

Restrictions

Parameters

MSGID Message identifier

Specifies the identifier under which the message is stored. Each identifier must be unique within the message file. The format is pppnnnn: a 3-character prefix, then 4 characters from 0-9 and A-F. User-defined messages should use a prefix starting with U. This parameter is required.

Type
*NAME
Required
Yes
Length
7
Case
Uppercase

MSGF Message file

Specifies the message file where the message is stored. IBM-supplied files such as QCPFMSG cannot be specified unless the user has update authority to them. This parameter is required.

Type
*QUAL
Required
Yes
Case
Uppercase
*LIBL
Searches all libraries in the library list for the current thread until the first match is found.
*CURLIB
Uses the current library for the job to locate the file, or QGPL if no current library entry exists.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Message file Message file

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

MSG First-level message text

Specifies the message text shown, printed, or sent to a program or log. Up to 132 characters in apostrophes. Substitution variables in the form &n, with n from 1 to 99, can be embedded. This parameter is required.

Type
*CHAR
Required
Yes
Length
132
Case
Mixed case

SECLVL Second-level message text

Specifies the message help shown when the user presses Help, up to 3000 characters in apostrophes. Format control characters &N, &P, and &B can be used, each followed by a blank.

Type
*CHAR
Required
No
Default
*NONE
Length
3000
Case
Mixed case

Suggested / special values: *NONE

*NONE
There is no message help for this message description.

SEV Severity code

Specifies the severity code, from 00 to 99. Higher values indicate more severe or important conditions. 00 is informational and 99 means manual action is required.

Type
*UINT2
Required
No
Default
00
Range
0 to 99
Case
Uppercase

FMT Message data fields formats

Specifies the formats of up to 99 message data fields. Each field has a data type, a length, and optionally decimal positions. Fields can be substituted in the message text and help and used in DMPLST and ALROPT.

Type
*ELEM
Required
No
Default
*NONE
List limit
99
Case
Uppercase

Suggested / special values: *NONE

*NONE
No message data fields are described, so none can be referenced in MSG, SECLVL, DMPLST, or ALROPT.
*QTDCHAR
Character string shown with enclosing apostrophes.
*CHAR
Character string shown without apostrophes. Trailing blanks are truncated.
*HEX
Byte string shown as hexadecimal, such as X'C0F4'.
*DEC
Packed decimal shown as a signed decimal with a decimal point. Length and optional decimal positions are required.
*BIN
2-, 4-, or 8-byte binary shown as a signed decimal.
*UBIN
2-, 4-, or 8-byte binary shown as an unsigned decimal.
*VARY
Length is variable. The passed data is preceded by a 2- or 4-byte binary length field. This is the default for character and hex types when no length is given.
Elements in order

Data type Data type

Type
*CHAR
Required
No
Length
8
Case
Uppercase

Allowed values: *QTDCHAR, *CHAR, *HEX, *SPP, *DEC, *BIN, *UBIN, *CCHAR, *UTC, *UTCD, *UTCT, *DTS, *SYP, *ITV

Length Length

Type
*INT4
Required
No
Default
*VARY
Case
Uppercase

Suggested / special values: *VARY

*VARY bytes or dec pos *VARY bytes or dec pos

Type
*INT4
Required
No
Default
0
Case
Uppercase

TYPE Reply type

Specifies the reply type for an inquiry or notify message, which drives reply validity checking.

Type
*CHAR
Required
No
Default
*CHAR
Length
6
Case
Uppercase

Allowed values: *CHAR, *DEC, *ALPHA, *NAME, *NONE

*CHAR
Any character string. Apostrophes in a quoted string are passed as part of the string.
*NONE
No reply type and no reply validity checking. LEN(*NONE) must also be specified.
*DEC
Only a decimal number is a valid reply.
*ALPHA
Only an alphabetic string is valid. Blanks are not allowed.
*NAME
Only a simple name starting with a letter is valid. If all characters are A-Z, the reply is converted to uppercase.

LEN Maximum reply length

Specifies the maximum reply length. It applies only when a validity checking parameter is specified. Otherwise a reply can be up to 132 characters.

Type
*ELEM
Required
No
Default
*TYPE
Case
Uppercase

Suggested / special values: *TYPE, *NONE

*TYPE
The maximum length is determined by the reply type.
*NONE
No reply length is specified. TYPE(*NONE) must also be specified.
Elements in order

Length Length

Type
*INT4
Required
No
Case
Uppercase

Decimal positions Decimal positions

Type
*INT4
Required
No
Default
0
Case
Uppercase

VALUES Valid reply values

Specifies up to 20 values, one of which must match for a reply to be valid. Cannot be combined with RANGE or REL.

Type
*CHAR
Required
No
Default
*NONE
Length
32
List limit
20
Case
Mixed case

Suggested / special values: *NONE

*NONE
No list of reply values is specified. Any value consistent with the other validity specifications is accepted.

SPCVAL Special reply values

Specifies up to 20 from-value and optional to-value pairs. A reply that matches a from-value is mapped to its to-value, or sent as the from-value if no to-value is given.

Type
*ELEM
Required
No
Default
*NONE
List limit
20
Case
Uppercase

Suggested / special values: *NONE

*NONE
No special reply values are specified.
Elements in order

Original from-value Original from-value

Type
*CHAR
Required
No
Length
32
Case
Mixed case

Replacement to-value Replacement to-value

Type
*CHAR
Required
No
Length
32
Case
Mixed case

RANGE Range of reply values

Specifies the lower and upper limits for valid replies. Cannot be combined with VALUES or REL.

Type
*ELEM
Required
No
Default
*NONE
Case
Uppercase

Suggested / special values: *NONE

*NONE
No range values are specified.
Elements in order

Lower value Lower value

Type
*CHAR
Required
No
Length
32
Case
Uppercase

Upper value Upper value

Type
*CHAR
Required
No
Length
32
Case
Uppercase

REL Relationship for valid replies

Specifies a relational operator and value that a valid reply must satisfy. Cannot be combined with VALUES or RANGE.

Type
*ELEM
Required
No
Default
*NONE
Case
Uppercase

Suggested / special values: *NONE

*NONE
No relationship values are specified.
*EQ
Equal to.
*LE
Less than or equal to.
*GE
Greater than or equal to.
*GT
Greater than.
*LT
Less than.
*NE
Not equal to.
*NL
Not less than.
*NG
Not greater than.
Elements in order

Relational operator Relational operator

Type
*CHAR
Required
No
Length
3
Case
Uppercase

Allowed values: *EQ, *LE, *GE, *GT, *LT, *NE, *NL, *NG

Value Value

Type
*CHAR
Required
No
Length
32
Case
Uppercase

DFT Default reply value

Specifies the default reply used when the receiver has asked for default replies to all messages, when a message is deleted without a reply, or when an unmonitored notify message needs one.

Type
*CHAR
Required
No
Default
*NONE
Length
132
Case
Mixed case

Suggested / special values: *NONE

*NONE
No default reply is specified.

DFTPGM Default program to call

Specifies the program called to take default action when this message is sent as an escape message and the receiving program does not monitor for it. It is ignored for other message types.

Type
*QUAL
Required
No
Default
*NONE
Case
Uppercase

Suggested / special values: *NONE

*NONE
No default program is specified.
*LIBL
Searches all libraries in the library list until the first match is found.
*CURLIB
Uses the current library for the job to locate the program, or QGPL if no current library entry exists.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Default program to call Default program to call

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

DMPLST Data to be dumped

Specifies the job data and message data fields to dump when this escape message is sent and not monitored. It takes data field numbers from 1 to 99 and/or the job dump values.

Type
*INT2
Required
No
Default
*NONE
List limit
102
Range
1 to 99
Case
Uppercase

Suggested / special values: *JOB, *JOBINT, *JOBDMP, *NONE

*NONE
There is no dump list, so no dump occurs.
*JOB
Equivalent to DSPJOB with * for the job name and *PRINT for output.
*JOBDMP
The job's data areas are dumped as specified by DMPJOB.
*JOBINT
The internal machine data structures for the job are dumped to the machine error log as specified by DMPJOBINT.

LVL Level of message

Specifies the level identifier, made of a definition date and a 2-digit number, that keeps the identifier unique.

Type
*ELEM
Required
No
Case
Uppercase
*CURRENT
The current date is used as the first part of the level identifier.
Elements in order

Creation date Creation date

Type
*DATE
Required
No
Default
*CURRENT
Case
Uppercase

Suggested / special values: *CURRENT

Level number Level number

Type
*UINT2
Required
No
Default
1
Range
1 to 99
Case
Uppercase

ALROPT Alert options

Specifies the alert option for messages sent to the history log (QHST) or the system operator message queue (QSYSOPR), so that an alert can be sent to a host system.

Type
*ELEM
Required
No
Case
Uppercase
*NO
No alert is sent.
*IMMED
An alert is sent immediately, along with the message to QHST or QSYSOPR.
*UNATTEND
An alert is sent immediately only when ALRSTS(*UNATTEND) is set on CHGNETA.
*DEFER
The alert is sent after local problem analysis.
*NONE
No message data field format number is passed with the alert identifier.
Elements in order

Alert type Alert type

Type
*CHAR
Required
No
Default
*NO
Length
9
Case
Uppercase

Allowed values: *IMMED, *DEFER, *UNATTEND, *NO

Resource name variable Resource name variable

Type
*UINT2
Required
No
Default
*NONE
Range
1 to 99
Case
Uppercase

Suggested / special values: *NONE

LOGPRB Log problem

Specifies, for IBM-supplied messages, whether an entry is put in the problem log so that problem analysis can be requested from DSPMSG *SYSOPR.

Type
*CHAR
Required
No
Default
*NO
Length
4
Case
Uppercase

Allowed values: *NO, *YES

*NO
No entry is put in the problem log.
*YES
An entry is put in the problem log if the message has an error log ID.

CCSID Coded character set ID

Specifies the CCSID of the MSG and SECLVL text. The text is converted to the message file's CCSID unless that file is 65534 or 65535.

Type
*UINT2
Required
No
Default
*JOB
Range
1 to 65535
Case
Uppercase

Suggested / special values: *JOB, *HEX

*JOB
The text is assumed to be in the CCSID of the job running the command.
*HEX
The text is not converted and is tagged as 65535.

Examples

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')

Defines message UIN0115 in file INV. The help lists three department codes on separate lines, replies are validated as 3-character values, and the default reply is ZZZ.

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)

Defines an escape message with severity 75 and three data fields. If an unmonitored program receives it, the three data fields and the job are dumped, then program BADTAX is called.

IBM command documentation

Generated from os/cl/catalog/ADDMSGD.json and os/cl/help/ADDMSGD.json.