Export Messages from a Queue as a PDF File

When sharing information with team members or people in other groups, have you ever wanted to export/save messages from a queue into something other than a plain text file?

In this blog posting, I will show you how to use MQ Visual Edit, MQ Visual Browse or MQ Batch Toolkit to generate a PDF or RTF or HTML file from 1 or more messages in a queue. The user can select to include the MQMD header and the format of the message data (i.e. Raw Data, Hex Data or EBCDIC Hex Data).

If the message’s MQMD Format field is set to any of the following values: MQRFH, MQRFH2 (i.e. JMS), MQCIH, MQDEAD, MQIIH, MQXMIT, MQHSAP and SMQBAD then the product will format the message data to the proper fields and values.

Why live in the dark ages with message data being dumped to a plain text files when you can generate and share MQ messages in a well-formatted PDF file.

1) Lets start with MQ Visual Edit and MQ Visual Browse. The same process is used in both products. Note: The Generate Report feature was introduced in version 1.5.5.

  • First, open the queue and then select 1 or messages in the main panel.
  • Next, from the main panel, select Edit, then Generate Report and the user will see the following popup window:
  • The user now selects how the messages are to be generated into the report:
    • The user may use the Browse button to select the directory and file name to be used for the report file.
    • The user can select PDF or RTF or HTML for the report type.
    • The user can select Raw Data or Hex Data or EBCDIC Hex for how the message data will be formatted in the report.
    • The user can select to include the message’s MQMD in the report.

  • Finally, the user will click the Save button to generate the report.

2) MQ Batch Toolkit is a command-line driven product and to generate a report from 1 or more messages, the user will use the Report command. Note: The Generate Report feature was introduced in version 2.0.0.

Syntax for the Report command:
mqbt Report [-a Path_and_FileName_for_CommProfileDB] -p Profile_Name -q Queue_Name [-s Start_Position] [-c Message_Count] [-l layout_format] [-C] [-D] [-M] [-H] [-E]

Required Parameters

Key Parameter Description
-p Profile_Name The name of a profile contained in the CommProfileDB.properties file.
-q Queue_Name The name of the queue (Note: Queue names are case sensitive.)

Optional Parameters

Key Parameter Description
-a Path_and_FileName The full path and filename for a CommProfileDB.properties file.
-s Start_Position Start position when getting messages from the queue. The default is 1.
-c Message_Count Number of messages to be read from the queue. The default is all messages.
-l layout_format The layout format of the file: PDF, RTF or HTML
-C Convert on Get
-D Remove messages from the queue as they are read (destructive get).
-M Generate a report that includes the MQMD fields
-H Generate a report that includes the message data in a hex format.
-E Generate a report that includes the message data in a hex format but the character convert to EBCDIC.

Example 1: Generate a PDF report using all messages in a queue.

mqbt Report -p MQA1 -q TEST01.Q

Example 2: Generate a PDF report using all messages in a queue and include the MQMD header.

mqbt Report -p MQA1 -q TEST01.Q -M

Example 3: Generate a PDF report using all messages in a queue in Hex format.

mqbt Report -p MQA1 -q TEST01.Q -H

Example 4: Generate a PDF report using all messages in a queue in Hex format and include the MQMD header.

mqbt Report -p MQA1 -q TEST01.Q -H -M

The MQ Batch Toolkit generated reports will be stored in the report directory under the MQ Batch Toolkit installation directory with the format of the file as QMgrName_QName_Date_Time.pdf.

Here are 5 sample PDF reports:

So there you have it, 3 different products that can generate a PDF report from messages in a queue.

Regards,
Roger Lacroix
Capitalware Inc.

This entry was posted in Capitalware, IBM i (OS/400), IBM MQ, Java, Linux, macOS (Mac OS X), MQ Batch Toolkit, MQ Visual Browse, MQ Visual Edit, Unix, Windows, z/OS.

Comments are closed.