Both SNDPGMMSG and SNDUSRMSG are CL commands used to send messages in IBM i, but they serve different purposes and have distinct characteristics:
SNDPGMMSG (Send Program Message)
*STATUS*ESCAPE*NOTIFY*COMPL (Completion)*DIAG (Diagnostic)*EXT)SNDUSRMSG (Send User Message)
*INQ (Inquiry)*INFO (Informational)*COMPL (Completion)*DIAG (Diagnostic)Key Differences Summarized:
| Feature | SNDPGMMSG | SNDUSRMSG |
|---|---|---|
| Primary Use | Intra-program/call stack communication | User/operator communication |
| Message Types | Wider range (status, escape, notify, etc.) | Primarily inquiry and informational |
| Destination | Job's external queue, specific queue, caller's queue | User's queue, operator's queue, display station |
In essence:
SNDPGMMSG is for internal program communication and error handling.SNDUSRMSG is for interacting with users or the system operator.Example:
If you want to display a message to the user asking for confirmation, you would use SNDUSRMSG with MSGTYPE(*INQ). If you want to send a message to the calling program indicating that a subroutine has completed successfully, you would use SNDPGMMSG with MSGTYPE(*COMPL).