When SEND_MESSAGE SQL procedure was introduced in 2021, as part of IBM i 7.3 TR10 and 7.4 TR4, it would be used to send messages to the System operator message queue. I have used this many times to do so, but I have always wondered how I could do the same to any message queue? Well, in the latest Technology Refreshes, IBM i 7.6 TR1 and 7.5 TR7, this functionality was added.
Two new parameters were added to the procedure to make this possible:
- MESSAGE_QUEUE_LIBRARY: The library that contains the message queue I want to send the message to
- MESSAGE_QUEUE: The message queue I want to send the message to
If I omit these parameters the message will be sent to the System operator message queue.
The first example I am going to show is using the procedure as it was intended, sending a message to the System operator message queue. I am going to use the message id CPF9898, which is a general escape message, i.e. I can provide any text I want for the message to use. I can show this using the MESSAGE_FILE_DATA SQL View:



