title: Will MQSC define queue command ever delete or corrupt messages?
body: <p>In WebSphere MQ 6, I want to script the creation of new queues. However the queues may already exist, and I need the script to be idempotent.</p>
  
  <p>I can create queues using the commands <a href="http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzaj.doc/sc11190_.htm" rel="nofollow">documented here</a>. For example:</p>
  
  <pre><code>DEFINE QREMOTE(%s) RNAME(%s) RQMNAME(%s) XMITQ(%s) DEFPSIST(YES) REPLACE
  </code></pre>
  
  <p>or </p>
  
  <pre><code>DEFINE QLOCAL(%s) DESCR(%s) DEFPSIST(YES) REPLACE
  </code></pre>
  
  <p>The <code>REPLACE</code> keyword ensures that creation does not fail if the queue already exists.</p>
  
  <p>I've tested this with an existing, non-empty queue and it seems that no messages were lost. However this is not proof enough. I need to be certain that no messages will ever be lost or corrupted if I run a <code>DEFINE Q... REPLACE</code> command against an existing queue. The existing queue might even be participating in transactions at the time.</p>
  
  <p>Can anyone confirm or deny this behaviour?</p>