Retrieving list of messages and displaying in PHP

[adrotate group=”3,7,8,9″]

We have been looking at how to display the messages generated by our products to allow the user to view them. Generating a list of the messages and the first level text was pretty simple, but we wanted to be able to retrieve the 1st and second level text from the message after it has been selected. The reason we wanted to do it this way was to reduce the data being sent between the systems. We have the Easycom Server running on both systems so we use the functionality provided by it to call the required programs and generate the data. We are also running this from the iAMP Server which is running on one of the systems and calling Easycom on both systems, we think this is a great solution as it allows us to pull data from any IBMi system running Easycom which we have access to..

The first list is generated by a program call which creates a list of the messages in the queue using the QGYOLMSG API, this allows us to get all the messages at once and return them to the PHP page. Once the list has been built we then needed to be able to get the individual message information back, to do this we have to use the QMHLSTM API which allows us to pull a single message back using a message key which we had received using the QGYOLMSG API.

After some head scratching we finally found a way to get the message key passed into the QMHLSTM API in the correct format (the key is converted when being passed back to the PHP page so we had to convert it back to HEX from Character String) and the results are pretty swish even if I do say so myself…

Here is an image showing the list of messages retrieved in the first call, this is from our High Availability Product HA4i but we also have the same process installed for JobQGenie and DR4i.

Message Listing
Message Listings

The Display link in the left hand column links to a new page which display the following. We took a CPF message and not one of the HA4i Messages to show the second level text it retrieves.

Message Detail output
Message Details

And that’s it, we can now display the content of the message queues very elegantly (OK so the CSS is not brilliant) and effectively. Application modernization at its best..


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.