vscode-ibmi icon indicating copy to clipboard operation
vscode-ibmi copied to clipboard

Add message queue view/action support

Open m-tyler opened this issue 3 years ago • 7 comments
trafficstars

If I run a program that has an error, like running an interactive program in batch, the job the program runs in gets an error. I cannot reply to that error unless I open a 5250 session run DSPMSG QSYSOPR and answer my job message. I would like to have a feature to see these messages and reply to them.

This feature should be flexible enough to add any MSGQ to view.

THanks, Matt

m-tyler avatar Feb 01 '22 17:02 m-tyler

An awesome idea.

FIrst step is to look into what commands, APIs or SQL services we could use to fetch items from a message queue. If you know any, feel free to share them here.

worksofliam avatar Feb 01 '22 19:02 worksofliam

INQUIRY using SQL (taken from ACS RUN SQL Scripts Examples)

-- -- category: IBM i Services -- description: Message Handling - Review system operator inquiry messages

-- Examine all system operator inquiry messages that have a reply (runs along time)

SELECT a.message_text AS "INQUIRY", b.message_text AS "REPLY", B.FROM_USER, B.*, A.* FROM qsys2.message_queue_info a INNER JOIN qsys2.message_queue_info b ON a.message_key = b.associated_message_key WHERE A.MESSAGE_QUEUE_NAME = 'QSYSOPR' AND A.MESSAGE_QUEUE_LIBRARY = 'QSYS' AND B.MESSAGE_QUEUE_NAME = 'QSYSOPR' AND B.MESSAGE_QUEUE_LIBRARY = 'QSYS' ORDER BY b.message_timestamp DESC;

-- -- category: IBM i Services -- description: Message Handling - Review system operator unanswered inquiry messages

-- Examine all system operator inquiry messages that have no reply (runs in acceptable time)

WITH REPLIED_MSGS(KEY) AS ( SELECT a.message_key FROM qsys2.message_queue_info a INNER JOIN qsys2.message_queue_info b ON a.message_key = b.associated_message_key WHERE A.MESSAGE_QUEUE_NAME = 'QSYSOPR' AND A.MESSAGE_QUEUE_LIBRARY = 'QSYS' AND B.MESSAGE_QUEUE_NAME = 'QSYSOPR' AND B.MESSAGE_QUEUE_LIBRARY = 'QSYS' ORDER BY b.message_timestamp DESC ) SELECT a.message_text AS "INQUIRY", A.* FROM qsys2.message_queue_info a LEFT EXCEPTION JOIN REPLIED_MSGS b ON a.message_key = b.key WHERE MESSAGE_QUEUE_NAME = 'QSYSOPR' AND MESSAGE_QUEUE_LIBRARY = 'QSYS' AND message_type = 'INQUIRY' ORDER BY message_timestamp DESC;

m-tyler avatar Feb 01 '22 20:02 m-tyler

@m-tyler Great - thanks.

If I were to add a new view, how would you want it to look? Add many message queues and open them like a treeview?

worksofliam avatar Feb 01 '22 20:02 worksofliam

INQUIRY and/or REPLY using system APIS

These APIs are mostly likely system version independent than using the IBM views.

Receive Nonprogram Message (QMHRCVM) API Send Reply Message (QMHSNDRM) API

m-tyler avatar Feb 01 '22 20:02 m-tyler

I suppose you could monitor for an object type of *MSGQ and then expand (somewhere). I would prefer a grid with additional filters, but if a tree list if simpler that is the better option. The first iteration should probably be just for INQUIRY of an *MSGQ.

My first preference is in a new IBM i section.

m-tyler avatar Feb 01 '22 20:02 m-tyler

@m-tyler I could easily create a view and then it can be moved to wherever the user would like.

What are some of the right click options you would have on entries?

worksofliam avatar Feb 01 '22 20:02 worksofliam

Delete and Reply for starters. If you have the list be limited to the amount of data from the inquiry, you could also present a details panel to show more data.

This is what we have in RDi from iSphere project. image

m-tyler avatar Feb 01 '22 20:02 m-tyler