Creating or changing a message queue
To create your own user message queues, use the Create Message Queue (CRTMSGQ) command. In addition, you can use the Change Message Queue (CHGMSGQ) command to change attributes of your message queue. To view the contents of the message queue, use the Display Messages (DSPMSG) or Work with Messages (WRKMSG) command.
The attributes of a message queue are as follows:
- Whether changes to the message queue must be written immediately to the disk. Writing the changes immediately to the disk ensures that no messages are lost in cases like a system failure. Note that this will cause a decrease in system performance.
- The method of delivery for messages arriving at a message queue. When
a message queue is created, the method of delivery is defined as hold delivery.
When a display station is signed on, the user's message queue is set to the
mode specified in the user profile. The types of delivery you can specify
on the CHGMSGQ command are:
- Break delivery. A job is interrupted and a program is called to deliver the message. If a user program is not specified on the CHGMSGQ command that requests break delivery, or if *SAME is specified, the DSPMSG command automatically displays the message. Break messages for a job can be controlled with the BRKMSG parameter on the Change Job (CHGJOB) command.
- Notify delivery. A display station user is notified by means of the attention light or audible alarm (or by both) that a message is on the queue. The display station user can view the message by using the DSPMSG or WRKMSG command.
- Hold delivery. The message queue holds the messages until the display station user requests them with the DSPMSG or WRKMSG command.
- Default delivery. All messages are ignored, and any messages requiring a reply are sent the default reply for the message.
- How to handle messages for break delivery.
- Automatically run the DSPMSG command. For an interactive job, the messages are displayed at the display station if the severity code is high enough. For a batch job, the messages are listed to a spooled printer file if the severity code is high enough.
- Call a break-handling program to handle the messages. You must use the CHGMSGQ command to specify the called program and to set the method of delivery to break mode. You can specify whether other jobs can reply to inquiry messages on the queue while it is in break mode with a break-handling program.
- The severity code for filtering messages for break and notify delivery.
Messages with severity equal to or greater than the minimum severity code
specified are displayed. When the queue is created, the minimum severity
code is set to 00. To change the minimum severity code, you must use the CHGMSGQ command.
When the DSPMSG command is used to display messages on the message queue, the severity code filter (SEV) parameter can be used to filter the messages shown. This filter is used rather than the severity filter specified for the message queue at creation time. To use this filter, specify DSPMSG SEV(*MSGQ). You can use the DSPMSG command to determine the current severity code used for filtering break and notify messages. The code is displayed on the heading line of the message display.
- Coded character set identifier (CCSID) associated with the message queue. Messages sent to this queue are converted to this CCSID. No conversions occur if the message queue CCSID is 65534 or 65535. If the message queue CCSID is 65534, each message contains its own CCSID which is established by the sender.
- Allow alerts for standard message queues. Allow alerts specifies if the queue being created allows alerts to be generated from alert messages that are sent to it.
- Action to take when the message queue becomes full.
- Send CPF2460 (Message queue cannot be extended) to the program or user that sends a message to the full queue.
- Wrap the queue. Wrapping will remove messages on the queue to make space for a new message that is sent to the queue.
The message queue defined in your user profile is known as a user message queue. When you sign on the system using your profile, the user message queue is put into the delivery mode specified in your user profile.
If your user message queue is in break or notify delivery mode while you are signed on a display station and then you sign on another display station, the user message queue will not change the delivery mode for the new sign-on. User message queues (along with workstation message queues and the QSYSOPR message queue) cannot have their delivery mode changed by a job when the message queue is in break or notify delivery mode for a different job.
When you sign off the display station, or the job ends unexpectedly, the user message queue delivery mode is changed to hold mode, if the delivery mode of the user message queue is break or notify for this job. The user message queue delivery mode is also changed from break or notify mode to hold mode when you transfer to a secondary job. You can do this using the Transfer Secondary Job (TFRSECJOB) command or by pressing the System Request key and specifying option 1 on the System Request menu.
After transferring to a secondary job, you sign on using your user profile. Your user message queue is put into the delivery mode specified in your user profile. This allows the user message queue to transfer to the secondary job. You are then able to transfer back and forth between these two jobs and have your user message queue follow you.
However, if after transferring to an alternative job, you sign on using a user profile other than your own, the user message queue for the job from which you transferred is left in hold delivery mode. The user message queue for the user profile you signed on with is put in the delivery mode specified in that user profile. Because of this, your user message queue could be put into break or notify delivery mode by another user. If another user still has your user message queue in that delivery mode when you transfer back to the first job, your user message queue delivery mode cannot be changed back to the original delivery mode.
The QSYSOPR message queue is the message queue for the system operator, unless it has been changed. The previous situation can occur for a system operator as well.