Ü Message queues
·
Message is information that is
communicated between users, programs and workstation.
·
Message queue is storage for
all the messages that are sent to users, programs or a workstation device.
·
We first of all store the
message in this storage pool that is sent by a user, program or workstation and
then as per the message type, we take the necessary action that suits the
respective messages and send it back to different user, program or workstation.
Ü Types of message queues
The system has different types of message queues:
·
workstation message queue
·
user profile message queue
·
job message queue
·
system operator message queue
·
history log message queue
Ø Workstation
message queues are used for sending and receiving messages between workstation
users and between workstation users and the system operator. The name of the
queue is the same as the name of the workstation. The queue is created by the
system when the workstation is described to the system. This is permanent
message queue.
Example: Sending message to a workstation
Here,
we have given the workstation name as UKF, hence the same will be used as
message queue for the workstation and any message intended to this workstation
is sent to UKF.
SNDMSG MSG('Do u want to continue the backup process')
TOMSGQ(UKF)
MSGTYPE(*INQ) RPYMSGQ(*WRKSTN)
DSPMSG
MSGQ(*WRKSTN)
Display Messages
System: UKFAI005
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: UKFAI005
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
Ø User
profile message queues can be used for communication between users. User profile message
queues are automatically created in library QUSRSYS when the user profile is
created. This is permanent message queue. Whenever we log in, the message queue
with the name as that of user is getting created as user profile message queue.
Example: Sending message to a user profile
Here, AJAISWAL
is the message queue which the name of the user logged in.
SNDMSG MSG('Do u want to continue the process')
TOUSR(AJAISWAL)
MSGTYPE(*INQ)
RPYMSGQ(AMIT)
DSPMSG MSGQ(*USRPRF)
Display Messages
System: UKFAI005
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
We
can see the reply message in the user profile AMIT.
Display Messages
System: UKFAI005
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
Ø Job
message queues are used for receiving requests to be processed (such as commands)
and for sending messages that result from processing the requests; the messages
are sent to the requester of the job. Job message queues exist for each job and
only exist for the life of the job. Hence, it is a temporary message queue. Job
message queues consist of an external
message queue (*EXT) and program
message queues.
As the program starts the system creates a
message queue for that program, known as program
message queue.
External
message queue sends information to the external
requester of the job who executed it. E.g. if there is any error it will be
shown at the bottom of the screen.
Example:
Sending message to external message queue
Ø SNDPGMMSG MSG ('THE END OF FILE IS REACHED') ==> It
will display the msg at the bottom row.
Work with Members Using PDM USALID09
File . . . . . . QRPGLESRC
Library . . . . AMIT Position to . . . . .
Type options, press Enter.
2=Edit 3=Copy 4=Delete 5=Display 6=Print 7=Rename
8=Display description 9=Save 13=Change text 14=Compile 15=Create module...
Opt Member Type Text
READFILE CLLE
READFILEO CLLE
REFER PF PHYSICAL FILE FOR REFERNCE
Bottom
Parameters or command
===>
F3=Exit F4=Prompt F5=Refresh F6=Create
F9=Retrieve F10=Command entry F23=More options F24=More keys
THE END OF FILE IS REACHED >>>>>>>>>>>>>>
Ø System
operator message queue (QSYSOPR) is used for receiving and replying to messages from the
system, display station users, and application programs. This is permanent
message queue.
Example: Sending message to the system operator
The message queue name for the system operator is QSYSOPR. If we
mention *SYSOPR, the message is sent to system operator message queue.
Any message sent to QSYSOPR automatically has a copy of the message
sent to QHST.
SNDMSG MSG('The message sent to sys operator')
TOUSR(*SYSOPR)
DSPMSG MSGQ(*SYSOPR)
Display Messages
System: UKFAI005
Queue . . . . . : QSYSOPR Program . . . . : *DSPMSG
Library . . . : QSYS Library . . . :
Severity . . . : 99 Delivery . . . : *HOLD
Type reply (if required), press Enter.
The message sent to sys operator
Bottom
F3=Exit F11=Remove a message F12=Cancel
F13=Remove all F16=Remove all except unanswered F24=More keys
*** NOTE: Use DSPLOG to see the history
log.
Ø History
log message queue is used for any job in the system to have a record of high-level
system activities. This is permanent message queue.
Example: 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
***NOTE: DSPMSG MSGQ(*WRKUSR)
It
will display the messages that have been sent to workstation as well as the
user.