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
- Requires object operational (*OBJOPR) and add (*ADD) authority for the message queue.
- Requires use (*USE) authority for the message queues and for the libraries containing them.
- Sends only up to 512 characters of first-level message text.
- Only inquiry messages (MSGTYPE(*INQ)) can go to one message queue, or to two if one of them is *HSTLOG.
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.
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.
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
Library
Library
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.
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.
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.
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
Library
Library
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.
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.
Generated from os/cl/catalog/SNDMSG.json and os/cl/help/SNDMSG.json.