Ü
SNDMSG
·
This command is used to send impromptu message
(messages i.e. not predefined) to the user/system operator/workstation/history
log.
·
It can be used in CL program or on command line
directly.
·
The format of this command is:
SNDMSG MSG(‘message text’)
TOUSR(user name/*SYSOPR/*ALLACT/*REQUESTER)
TOMSGQ(user queue name/workstation queue name/*SYSOPR/QHST)
MSGTYPE(*INFO/*INQ)
RPYMSGQ(user queue name/workstation queue name/*SYSOPR)
·
TOUSR and TOMSGQ parameter is mutually exclusive.
Only one should be mentioned at a time.
·
If TOUSR=*SYSOPR, then the message is sent to the
system operator.
·
If TOUSR=*ALLACT, then the message is sent to all
active users.
·
If TOUSR=*REQUESTER, then the message is sent to the
user who is running the interactive job or to QSYSOPR.
·
If TOMSG=QHST, then the message is sent to history
log.
Example-I: Sending message to user AJAISWAL and get the reply
to user AMIT
SNDMSG MSG('Do u want to continue the process')
TOUSR(AJAISWAL)
MSGTYPE(*INQ)
RPYMSGQ(AMIT)
System: SYSTEM005
Queue . . . . . : AJAISWAL Program . . . . : *DSPMSG
Library . . . : QUSRSYS Library . . . :
Severity . . . : 00 Delivery . . . : *NOTIFY
Type reply (if required), press Enter.
From . . . : AJAISWAL 23/04/13 08:47:12
Do u want to continue the process
Reply . . . N__________________________________________________________
Bottom
F3=Exit F11=Remove a message F12=Cancel
F13=Remove all F16=Remove all except unanswered F24=More keys
DSPMSG MSGQ(*USRPRF)
We
can see the reply message in the user profile AMIT.
Display Messages
System: SYSTEM05
Queue . . . . . : AMIT Program . . . . : *DSPMSG
Library . . . : QUSRSYS Library . . . :
Severity . . . : 00 Delivery . . . : *NOTIFY
Type reply (if required), press Enter.
From . . . : AJAISWAL 23/04/13 08:47:12
Do u want to continue the process
Reply . . : N
Bottom
F3=Exit F11=Remove a message F12=Cancel
F13=Remove all F16=Remove all except unanswered F24=More keys
Example-II: Sending message to workstation UKF and get the
reply to the same workstation
SNDMSG MSG('Do u want to continue the backup process')
TOMSGQ(UKF)
MSGTYPE(*INQ)
RPYMSGQ(*WRKSTN)
DSPMSG
MSGQ(*WRKSTN)
Display Messages
System: SYSTEM05
Queue . . . . . : UKF Program . . . . : *DSPMSG
Library . . . : QSYS Library . . . :
Severity . . . : 00 Delivery . . . : *NOTIFY
Type reply (if required), press Enter.
From . . . : AJAISWAL 23/04/13 07:50:53
Do u want to continue the backup process
Reply . . . __________________________________________________
Bottom
F3=Exit F11=Remove a message F12=Cancel
F13=Remove all F16=Remove all except unanswered F24=More keys
We send the reply as ‘Y’. The reply is sent to
the workstation as RPYMSGQ is *WRKSTN. We can check the reply as below.
DSPMSG MSGQ(*WRKSTN)
Display Messages
System: SYSTEM05
Queue . . . . . : UKF Program . . . . : *DSPMSG
Library . . . : QSYS Library . . . :
Severity . . . : 00 Delivery . . . : *NOTIFY
Type reply (if required), press Enter.
From . . . : AJAISWAL 23/04/13 07:50:53
Do u want to continue the backup process
Reply . . : Y
Bottom
F3=Exit F11=Remove a message F12=Cancel
F13=Remove all F16=Remove all except unanswered F24=More keys
Example-III: Sending message to
history log
SNDMSG MSG('Errors in the batch program at checkpoint 328.20')
TOMSGQ(QHST)
DSPLOG PERIOD(('01:01:01' '23/04/13') ('11:21:31'
'22/04/13'))
Display History Log Contents
Job 725522/QSYS/CRTPFRDTA ended on 23/04/13 at 00:00:08; 2.738 seconds used;
Job 725643/QTMHHTTP/ADMIN started on 23/04/13 at 00:00:16 in subsystem QHTTPS
Job 725643/QTMHHTTP/ADMIN ended on 23/04/13 at 00:00:17; .028 seconds used; e
Errors in the batch program at checkpoint 328.20 …….. …..
More...
Press Enter to continue.
F3=Exit F10=Display all F12=Cancel