Command reference / msg

SNDMSG

Send Message

Used by a display station user to send an immediate message (one that is not predefined and not stored in a message file) to one or more message queues. Targets can be the system operator, other users, a user's message queue, the queues of all currently active users, or the system history log QHST. The sender can require a reply. Mainly used by display station users and the system operator.

Allowed environments: *ALL. Positional parameters: 4.

Restrictions

Parameters

MSG Message text

Specifies the immediate message to send. Enclose the text in apostrophes if it contains blanks or special characters. Up to 512 characters. Required.

Type
*CHAR
Required
Yes
Length
512
Case
Mixed case

TOMSGQ To message queue

Specifies one to fifty message queues that receive an informational message. An inquiry can go to one queue, or to two if one is *HSTLOG. Cannot be used with TOUSR. Either TOMSGQ or TOUSR is required.

Type
*QUAL
Required
No
List limit
50
Case
Uppercase

Suggested / special values: *SYSOPR

*SYSOPR
Sends to QSYS/QSYSOPR. A copy also goes to QHST.
*HSTLOG
Sends to the system history log queue QSYS/QHST. Sent only once even if specified more than once.
*LIBL
Searches the libraries in the thread's library list until the first match is found.
*CURLIB
Uses the job's current library, or QGPL if there is no current library entry.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Message queue Message queue

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

TOUSR To user profile

Sends the message to the message queue in the named user profile. Cannot be used with TOMSGQ. Either TOUSR or TOMSGQ is required.

Type
*NAME
Required
No
Length
10
Case
Uppercase

Suggested / special values: *SYSOPR, *REQUESTER, *ALLACT

*SYSOPR
Sends to QSYS/QSYSOPR. A copy also goes to QHST.
*REQUESTER
Sends to the user profile queue for interactive jobs, or to QSYSOPR for batch jobs.
*ALLACT
Sends a copy to the user profile queue of each user with a running interactive job. Cannot be used with inquiry messages.

MSGTYPE Message type

Specifies whether the message is informational or an inquiry that the receiving queue can reply to.

Type
*CHAR
Required
No
Default
*INFO
Length
5
Case
Uppercase

Allowed values: *INFO, *INQ

*INFO
Sends an informational message.
*INQ
Sends an inquiry the receiving queue can reply to. Sent to one queue at a time, or to two if the second is *HSTLOG.

RPYMSGQ Message queue to get reply

Specifies, only when an inquiry is sent, the message queue that receives the reply.

Type
*QUAL
Required
No
Default
*WRKSTN
Case
Uppercase

Suggested / special values: *WRKSTN

*WRKSTN
The reply goes to the sender's display station message queue. Not valid for batch jobs.
*LIBL
Searches the libraries in the thread's library list until the first match is found.
*CURLIB
Uses the job's current library, or QGPL if there is no current library entry.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Message queue to get reply Message queue to get reply

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

CCSID Coded character set ID

Specifies the CCSID of the supplied message text. Valid values are 1 through 65535, and the command validates the value.

Type
*INT4
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 this command.
*HEX
The text is not converted; CCSID 65535 is used.

Examples

SNDMSG MSG('Do you want to update INV now?') TOUSR(JONES) MSGTYPE(*INQ) RPYMSGQ(SMITH)

Sends an inquiry to user JONES's message queue. The reply goes to the message queue SMITH.

IBM command documentation

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