[ Previous part ]
Use the following as an example for your program.
////////////////////////////////////////////////////////////////////////////////// // // Example using the Message Queue function of the IBM Toolbox for Java // // This source is an example of IBM Toolbox for Java "Message Queue". // ////////////////////////////////////////////////////////////////////////////////// package examples; import java.io.*; import java.util.*; import com.ibm.as400.access.*; public class displayMessages extends Object { public static void main(String[] parameters) { displayMessages me = new displayMessages(); me.Main(parameters); System.exit(0); } void displayMessage() { } void Main(String[] parms) { try { AS400 system = new AS400(); if (parms.length > 0) system.setSystemName(parms[0]); MessageQueue queue = new MessageQueue(system, MessageQueue.CURRENT); Note 1 Enumeration e = queue.getMessages(); Note 2 while (e.hasMoreElements()) { QueuedMessage message = (QueuedMessage) e.nextElement(); Note 3 System.out.println(message.getText()); Note 4 } } catch (Exception e) { e.printStackTrace(); } } }
[ Previous part ]