title: JT400 - get messages from Queue
body: <p>I would like to get messages in AS400 from a queue other than a queue from QSYS.LIB. I am using the following code that runs well, only if I use a queue from within QSYS.LIB:</p>
  
  <pre><code>public String getMessagesFromQsysopr(boolean needReply) {
  
  
      String messageStr = "";
      try {
  
      MessageQueue queue = new MessageQueue(this.as400, "/qsys.lib/qsysopr.msgq");
   // want only inquiry messages
      queue.setSelectMessagesNeedReply(needReply);
      queue.setSelectMessagesNoNeedReply(!needReply);
      queue.setSelectSendersCopyMessagesNeedReply(needReply);
      queue.setListDirection(false);
  
      Enumeration e = queue.getMessages();
      while (e.hasMoreElements()) {
          QueuedMessage message = (QueuedMessage) e.nextElement();
          messageStr += message.getText()+"\n";
      }
  
  
  } catch (Exception e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>If I replace the /qsys.lib/qsysopr.msgq for any other queue from other lib, like for example "/yaclib.lib/queueName.msgq" I get the following error:</p>
  
  <p>com.ibm.as400.access.IllegalPathNameException: /yaclib.lib/queueName.msgq: <strong>Object not in QSYS file system</strong>.
      at com.ibm.as400.access.QSYSObjectPathName.parse(QSYSObjectPathName.java:599)
      at com.ibm.as400.access.QSYSObjectPathName.(QSYSObjectPathName.java:169)
      at com.ibm.as400.access.QSYSObjectPathName.(QSYSObjectPathName.java:177)
      at com.ibm.as400.access.MessageQueue.(MessageQueue.java:299)
      at br.com.operation.AS400Inspector.getMessagesFromYaclib(AS400Inspector.java:225)
      at br.com.operation.Main.main(Main.java:43)</p>
  
  <p><strong>Question 1:</strong> What am I doing wrong?</p>
  
  <p><strong>Question 2:</strong> Is there any way to limit the messages that don't need reply? Like get messages after a specific date or just the last 2 day messages?</p>
  
  <p>Thanks.</p>