MQ Batch Toolkit

Chapter 6 Reading Messages

Reading Messages - Raw Data with MQMD

This section will describe how to read a message from a queue and displaying the message's 'Message Descriptor' header.

Purpose

Use the Read command to read messages in the queue.

Syntax

{mqbt or mqbt.sh} Read -a Path_and_FileName_for_CommProfileDB -p Profile_Name -q Queue_Name [-s Start_Position] [-c Message_Count] [-C] [-D] [-M] [-H] [-E]

Function Name:
Read

Required Parameters:
-a The full path and filename for a CommProfileDB.properties file.
-p The name of a profile contained in the CommProfileDB.properties file.
-q The name of the queue. (Note: Queue names are case sensitive.)

Optional Parameters:
-s Start position when getting messages from the queue. The default is 1.
-c Number of messages to be read from the queue. The default is all messages.
-C Convert on Get
-D Remove messages from the queue as they are read (destructive get).
-M Display the MQMD fields before display the message's data.
-H Display the message data in a hex format.
-E Display the message data in a hex format but the character convert to EBCDIC.

Example 1

  • Read all messages from the queue and display the message's MQMD (message descriptor).

    Windows
    mqbt Read -a c:\CommProfileDB.properties -p MQA1 -q TEST01.Q -M
    Unix
    ./mqbt.sh Read -a /Capitalware/MQBT/CommProfileDB.properties -p MQA1 -q TEST01.Q -M

    If the queue had 1 message, it may look like this (the message text begins after 'Raw Data:'):
    ------------------------------ Message # 1 ------------------------------
    Message Descriptor:
    *General:
      Version: 2                   Message Type: MQMT_DATAGRAM
      Message Priority: 0          Message Persistence: MQPER_NOT_PERSISTENT
      Put Date: 2004-08-30         Expiry Interval: -1
      Put Time: 01:40:12.280       Backout Count: 0
      Reply-To Queue:
      Reply-To Queue Manager:      MQA1
    *Report:
      Report: 0                    Original Length: -1
      Feedback Code: MQFB_NONE
    *Context:
      User ID:                     'rlacroix    '
      Put-Application Type:        MQAT_WINDOWS_NT
      Put-Application Name:        'C:\WINNT\system32\javaw.exe '
      Application Identity Data:   '                                '
      Application Origin Data:     '    '
      Accounting Token:            X'16010515000000235F636B54EC114F828BA628E803000000000000000000000B'
    *Identifiers:
      Message ID:                  X'414D51204D5141312020202020202020F9BB324120000401'
      Correlation ID:              X'000000000000000000000000000000000000000000000000'
      Group ID:                    X'000000000000000000000000000000000000000000000000'
    *Segmentation:
      Logical Sequence Number: 1
      Offset: 1                    Message Flags: 0
    *Attributes:
      Format: MQSTR                Message Data Length: 55
      CCSID: 819                   Encoding: 273
    
    Raw Data:
    This is a test message.
    Line #2
    and the last line - #3

     


    Reading Messages - Hex Data with MQMD

    This section will describe how to read a message from a queue and displaying it in Hex format along with the message's 'Message Descriptor' header.

    Purpose

    Use the Read command to read messages in the queue.

    Syntax

    {mqbt or mqbt.sh} Read -a Path_and_FileName_for_CommProfileDB -p Profile_Name -q Queue_Name [-s Start_Position] [-c Message_Count] [-C] [-D] [-M] [-H] [-E]

    Function Name:
    Read

    Required Parameters:
    -a The full path and filename for a CommProfileDB.properties file.
    -p The name of a profile contained in the CommProfileDB.properties file.
    -q The name of the queue. (Note: Queue names are case sensitive.)

    Optional Parameters:
    -s Start position when getting messages from the queue. The default is 1.
    -c Number of messages to be read from the queue. The default is all messages.
    -C Convert on Get
    -D Remove messages from the queue as they are read (destructive get).
    -M Display the MQMD fields before display the message's data.
    -H Display the message data in a hex format.
    -E Display the message data in a hex format but the character convert to EBCDIC.

    Example 1

  • Read all messages from the queue and display the message's MQMD (message descriptor).

    Windows
    mqbt Read -a c:\CommProfileDB.properties -p MQA1 -q TEST01.Q -H -M
    Unix
    ./mqbt.sh Read -a /Capitalware/MQBT/CommProfileDB.properties -p MQA1 -q TEST01.Q -H -M

    If the queue had 1 message, it may look like this (the message text begins after 'Raw Data:'):
    ------------------------------ Message # 1 ------------------------------
    Message Descriptor:
    *General:
      Version: 2                   Message Type: MQMT_DATAGRAM
      Message Priority: 0          Message Persistence: MQPER_NOT_PERSISTENT
      Put Date: 2004-08-30         Expiry Interval: -1
      Put Time: 01:40:12.280       Backout Count: 0
      Reply-To Queue:
      Reply-To Queue Manager:      MQA1
    *Report:
      Report: 0                    Original Length: -1
      Feedback Code: MQFB_NONE
    *Context:
      User ID:                     'rlacroix    '
      Put-Application Type:        MQAT_WINDOWS_NT
      Put-Application Name:        'C:\WINNT\system32\javaw.exe '
      Application Identity Data:   '                                '
      Application Origin Data:     '    '
      Accounting Token:            X'16010515000000235F636B54EC114F828BA628E803000000000000000000000B'
    *Identifiers:
      Message ID:                  X'414D51204D5141312020202020202020F9BB324120000401'
      Correlation ID:              X'000000000000000000000000000000000000000000000000'
      Group ID:                    X'000000000000000000000000000000000000000000000000'
    *Segmentation:
      Logical Sequence Number: 1
      Offset: 1                    Message Flags: 0
    *Attributes:
      Format: MQSTR                Message Data Length: 55
      CCSID: 819                   Encoding: 273
    
    Hex Data:
      00000000  54 68 69 73 20 69 73 20 61 20 74 65 73 74 20 6D  'This is a test m'
      00000010  65 73 73 61 67 65 2E 0A 4C 69 6E 65 20 23 32 0A  'essage. Line #2 '
      00000020  61 6E 64 20 74 68 65 20 6C 61 73 74 20 6C 69 6E  'and the last lin'
      00000030  65 20 2D 20 23 33 0A                             'e - #3          '

     




  • Copyright © 2004-2008 Capitalware Inc.  All Rights Reserved.