in zos how do i code a generic open in cobol or assembler to get a list of local queues on a queue manager

Viewed 78

is there a way in either COBOL or assembler to open all the queues? i am looking to do an inquire and would simply like to scroll through all of the local queues on a queue manager. i have passed an asterisk in the object name field with no results (like you would do on the screen). i am looking to get back a list or a pointer to all of the queues that match '*' so i can do the inquire. I tried passing an asterisk in various input fields and altering other input fields to no success.

2 Answers

You can't achieve this by means of an MQOPEN and MQINQ. Instead you must send a message to the Command Server asking it for all the queue names.

You can do this in two ways, either asking for a list of just the queue names or by asking for all the queues with some/all their attributes. If you just need the names, then the former is more efficient.

This is done by means of the PCF Inquire Queue Names command. You will get a response message back on the reply queue you provide with contents as described in PCF Inquire Queue Names (Response).

I will look to see if I can find a z/OS COBOL or 390 Assembler sample/example to add to this answer, but the above links will get you started.

EDIT: Not having any luck finding a sample. Let me know if you need help with this and I can knock together something, but would be easier to help you with your code than try to start from scratch. Below some psuedo-code that will get you started.

MQCONN
MQOPEN(ReplyQ)
MQOPEN(SYSTEM.ADMIN.COMMAND.QUEUE)
Build PCF Message buffer to describe command
MQPUT(SYSTEM.ADMIN.COMMAND.QUEUE, Buffer, MQMD.ReplyToQ=name of ReplyQ)
MQGET(ReplyQ) for response messages
Walk through response to get all queue names out of response message

Two additional thoughts:

  • The SYSTEM.ADMIN.COMMAND.QUEUE that Morag mentioned mostly needs superior security level for this queue than others.
  • If you are not fixed to z/OS COBOL or 390 Assembler but familiar with REXX then i suggest former SupportPac MA95 and it's samples.
Related