Here’s an example of COBOL to get queue details using MQINQ. MQ-series is IBM middle-ware product that helps integrate heterogeneous interfaces. Don’t worry. I’ll help you with how to use this and show you how to use this.
What are Queue Attributes?
MQINQ provides queue attributes. The below table tells you the list of attributes of a Queue.
Attribute | Data Type | Description |
---|---|---|
ALTERATION_DATE | Character12 | Date definition last changed |
ALTERATION_TIME | Character8 | Time definition was last changed |
BACKOUT_REQ_Q_NAME | Character48 | Excessive backout requeue name |
BACKOUT_THRESHOLD | Numeric | Backout threshold |
BASE_Q_NAME | Character48 | Name of queue to which alias resolves |
CF_STRUC_NAME | Character12 | Coupling-facility structure name (z/OS only) |
CLUSTER_NAME | Character48 | Name of cluster to which queue belongs |
CLUSTER_NAMELIST | Character48 | Name of namelist containing names of clusters to which queue belongs |
CLUSTER_WORKLOAD_DATA | Character32 | User data for cluster workload exit |
CLUSTER_WORKLOAD_LENGTH | Numeric | Maximum length of message data passed to cluster workload exit |
CREATION_DATE | Character12 | Queue creation date |
CREATION_TIME | Character8 | Queue creation time |
CURRENT_Q_DEPTH | Numeric | Number of messages on queue |
DEF_BIND | Numeric | Default binding |
DEF_INPUT_OPEN_OPTION | Numeric | Default open-for-input option |
DEF_PERSISTENCE | Numeric | Default message persistence |
DEF_PRIORITY | Numeric | Default message priority |
DEF_XMIT_Q_NAME | Character48 | Default transmission queue name |
DEFINITION_TYPE | Numeric | Queue definition type |
EXPIRY_INTERVAL | Numeric | Interval between scans for expired messages (z/OS only) |
HARDEN_GET_BACKOUT | Numeric | Whether to harden backout count |
IGQ_PUT_AUTHORITY | Numeric | Intra-group queuing put authority (z/OS only) |
IGQ_USER_ID | Character12 | Intra-group queuing agent user ID (z/OS only) |
INDEX_TYPE | Numeric | Index type (z/OS only) |
INHIBIT_GET | Numeric | Whether get operations are allowedThis output type is not supported on z/OS. |
INHIBIT_PUT | Numeric | Whether put operations are allowed |
INITIATION_Q_NAME | Character48 | Initiation queue name |
INTRA_GROUP_QUEUING | Numeric | Intra-group queuing support (z/OS only) |
MAX_MSG_LENGTH | Numeric | Maximum message length |
MAX_Q_DEPTH | Numeric | Maximum number of messages allowed on queue |
MSG_DELIVERY_SEQUENCE | Numeric | Whether message priority is relevant |
OPEN_INPUT_COUNT | Numeric | Number of CALL MQOPEN routines that have the queue open for input |
OPEN_OUTPUT_COUNT | Numeric | Number of CALL MQOPEN routines that have the queue open for output |
PROCESS_NAME | Character32 | Name of process definition |
Q_DEPTH_HIGH_EVENT | Numeric | Control attribute for queue depth high eventsThis output type is not supported on z/OS. |
Q_DEPTH_HIGH_LIMIT | Numeric | High limit for queue depthThis output type is not supported on z/OS. |
Q_DEPTH_LOW_EVENT | Numeric | Control attribute for queue depth low eventsThis output type is not supported on z/OS. |
Q_DEPTH_LOW_LIMIT | Numeric | Low limit for queue depthThis output type is not supported on z/OS. |
Q_DEPTH_MAX_EVENT | Numeric | Control attribute for queue depth max eventsThis output type is not supported on z/OS. |
Q_DESC | Character64 | Queue description |
Q_NAME | Character48 | Queue name |
Q_SERVICE_INTERVAL | Numeric | Limit for queue service intervalThis output type is not supported on z/OS. |
Q_SERVICE_INTERVAL_EVENT | Numeric | Control for queue service interval eventsThis output type is not supported on z/OS. |
Q_TYPE | Numeric | Queue type |
QSG_DISP | Numeric | Queue-sharing group disposition (z/OS only) |
QSG_NAME | Character4 | Name of queue-sharing group (z/OS only) |
REMOTE_Q_MGR_NAME | Character48 | Name of remote queue manager |
REMOTE_Q_NAME | Character48 | Name of remote queue as known on remote queue manager |
RETENTION_INTERVAL | Numeric | Queue retention interval |
SCOPE | Numeric | Queue definition scopeThis output type is not supported on z/OS. |
SHAREABILITY | Numeric | Whether queue can be shared |
STORAGE_CLASS | Character8 | Storage class for queue (z/OS only) |
TRIGGER_CONTROL | Numeric | Trigger control |
TRIGGER_DATA | Character64 | Trigger data |
TRIGGER_DEPTH | Numeric | Trigger depth |
TRIGGER_MSG_PRIORITY | Numeric | Threshold message priority for triggers |
TRIGGER_TYPE | Numeric | Trigger type |
USAGE | Numeric | Usage |
XMIT_Q_NAME | Character48 | Default transmission queue name |
In total, attributes of four objects you’ll get when you call MQINQ. Below is the list (Queues, Namelists, Process definitions, and Queue Manager).
- Table 1 MQINQ attribute selectors for queues
- Table 2 MQINQ attribute selectors for namelists
- Table 3 MQINQ attribute selectors for process definitions
- Table 4 MQINQ attribute selectors for the queue manager
How to Get Queue Depth? (Number of Messages in a Queue)
COBOL Sample Logic to CALL MQINQ
If this call is successful, you’ll get queue attributes.
*
* Inquire about the attributes.
*
CALL 'MQINQ' USING W02-HCONN,
W02-HOBJ,
W02-SELECTORCOUNT,
W02-SELECTORS-TABLE, /* Here stores all the info*/
W02-INTATTRCOUNT,
W02-INTATTRS-TABLE,
W02-CHARATTRLENGTH,
W02-CHARATTRS,
W02-COMPCODE,
W02-REASON.
*
* Test the output from the inquiry:
*
* - If the completion code is not OK, display an error
* message showing the completion and reason codes
*
* - Otherwise, move the correct attribute status into
* the relevant screen map fields
*
IF W02-COMPCODE NOT = MQCC-OK
MOVE 'MQINQ' TO M01-MSG4-OPERATION
MOVE W02-COMPCODE TO M01-MSG4-COMPCODE
MOVE W02-REASON TO M01-MSG4-REASON
MOVE M01-MESSAGE-4 TO M00-MESSAGE
*
ELSE
* Process the changes.
⋮
END-IF.
⋮
After executing the above logic, you’ll get data into the selectors-Table. From it, you can get the ‘Q depth’ value, which ( CURRENT_Q_DEPTH ) tells the number of messages in a Queue.
References
Related Posts
Get new content delivered directly to your inbox.