Send Impromptu Message

SndMsg

The SndMsg procedure sends an impromptu (ad hoc) program message.

The SndMsg procedure uses user-supplied text to compose and send a program message.

msgKey    SndMsg(
  szMsgText        1024A   Const Varying
  szMsgType          10A   Const OPTIONS(*OMIT : *NOPASS : *VARSIZE )
  szToPgmQ           10A   Const OPTIONS(*OMIT : *NOPASS : *VARSIZE )
)

See also: SndMsgID, SndStsMsg, GetMsgText, GetMsgInfo

Parameters

szMsgText 
[input VChar(1024) ]  The message text to be send as a program message. Any message, up to 1024 bytes may be specified.
 
szMsgType  [ optional ] DFT(*INFO)
[input Char(10) ]  The type of message to send. If this parameter is specified, it must be enclosed in quotes or it must be a named constant or a field containing one of the following type codes:
Message Type Description
'*COMP' Completion message
'*DIAG' Diagnostic message
'*ESCAPE' Escape message
'*INFO' Informational message
'*INQ' Inquiry message (valid only when *EXT is specified for szToPgmQ
'*NOTIFY' Notification message
'*RQS' Request message
'*STATUS' Status message
*OMIT If *OMIT (not enclosed in quotes) is specified, the default for this parameter is used.
'*' If '*' is specified, the default value for this parameter is used.
 
szToPgmQ  Default('*SAME')
[input Char(10) ]  The program queue where the message is sent. If this parameter is not specified then '*' (*SAME) is used as the default. If specified, one of the following values may be specified and must be enclosed in quotation marks.
 
ToPgmQ Description
'*' The current program message queue
'*SAME' Same as *
'*PRV' Previous procedure message queue
'*PRVPGM' Previous program message queue
'*CTLBDY' Control boundary
'*EXT' External program message queue (used for *STATUS messages)
 

Return Value

The return value is the message key of the message once it is sent.

Remarks

     D MSGText         C                   Const('Customer Not found.')

 

     C                   eval       SndMsg(msgtext: '*DIAG':'*PRVPGM')

 

In this example the message text 'Customer Not Found.' is sent as an diagnostic message to previous program in the call stack.