Henry, Here is a simple example to get you started. What are you trying to accomplish?
David Morris/** * Program Call Example * @author: David Morris */ package pcml; import com.ibm.as400.data.ProgramCallDocument; import com.ibm.as400.data.PcmlException; import com.ibm.as400.access.AS400; import com.ibm.as400.access.AS400Message; import com.ibm.math.BigDecimal; public class ProgramCallExample { public ProgramCallExample() { } public static void main(String[] argv) { AS400 as400System; ProgramCallDocument pcd; boolean rc = false; String msgId; String msgText; String command = new String("dspjob output(*print)"); BigDecimal length = new BigDecimal(command.length()); System.setErr(System.out); as400System = new AS400(); try { // Remove comment on following line for more logging // com.ibm.as400.data.PcmlMessageLog.setTraceEnabled( true); pcd = new ProgramCallDocument(as400System, "qcmdexc"); // Set parameter values pcd.setValue("qcmdexc.command", command); pcd.setValue("qcmdexc.length", length); // Call program rc = pcd.callProgram("qcmdexc"); // If error on call return messages if (rc == false) { AS400Message[] msgs = pcd.getMessageList("qcmdexc"); for (int m = 0; m < msgs.length; m++) { msgId = msgs[m].getID(); msgText = msgs[m].getText(); System.out.println(msgId + " - " + msgText); } System.out.println("Error on call to QCMDEXC"); System.exit(0); } } catch (PcmlException e) { System.out.println(e.getLocalizedMessage()); e.printStackTrace(); System.out.println("Unexpected error on call to QCMDEXC"); System.exit(0); } System.exit(0); } }
Comment