• Get application security done the right way! Detect, Protect, Monitor, Accelerate, and more…
  • Working as an MQ administrator, you may often have to copy the messages from one queue to another queue for troubleshooting.

    Use dmpmqmsg to copy MQ message

    Copying messages from one queue to another is possible with an inbuilt program called dmpmqmsg in IBM MQ8. In this article, I will explain how to do so.

    Scenario – copy a message from LOCAL.Q1 to LOCAL.Q2 in CHANDAN.QMGR

    I have one message in LOCAL.Q1 now

    dis ql(LOCAL.Q1) curdepth
    1 : dis ql(LOCAL.Q1) curdepth
    AMQ8409: Display Queue details.
       QUEUE(LOCAL.Q1)                         TYPE(QLOCAL)
       CURDEPTH(1)

    To copy, I will use dmpmqmsg program.

    dmpmqmsg –m QMGR –i SOURCE.QUEUE –o TARGET.QUEUE
    -bash-4.2$ ./dmpmqmsg -m CHANDAN.QMGR -i LOCAL.Q1 -o LOCAL.Q2
    
    5724-H72 (C) Copyright IBM Corp. 1994, 2015.
    WebSphere MQ Queue Load/Unload Utility
    Read   - Files: 0 Messages:     1 Bytes:       39
    Written - Files:   0 Messages:     1 Bytes:       39
    -bash-4.2$

    The message is copied from LOCAL.Q1 to LOCAL.Q2.

    Let’s verify them.

    dis ql(LOCAL.Q2) curdepth
         1 : dis ql(LOCAL.Q2) curdepth
    AMQ8409: Display Queue details.
       QUEUE(LOCAL.Q2)                         TYPE(QLOCAL)
       CURDEPTH(1)

    So you see the message is copied to LOCAL.Q2 now.